使用openx API进行地理定位

时间:2010-09-13 23:08:29

标签: api openx

我正在使用openx api插入广告客户/广告系列/横幅,但我似乎找不到任何有关通过API对广告系列或横幅进行地理定位的文档。可以这样做,还是我必须开始直接注入数据库。

1 个答案:

答案 0 :(得分:2)

我在文档中也没有找到任何内容,但是我能够找到如何做到这一点。

以下是java代码。我使用了BannerXmlRpcService.php中的方法setBannerTargeting。

        public static String GEO_CONTINENT_LIMITATION = "deliveryLimitations:Geo:Continent";
        public static String GEO_COUNTRY_LIMITATION = "deliveryLimitations:Geo:Country";
        map = new HashMap();
        public static String[] CONTINENTS = new String[]{
        "AS","EU","AF","OC","CA","SA","NA","AQ",
        };
        public static String CONTAINS_OPERATOR = "=~";
        public static String OR_LOGICAL_OPERATOR = "or";

        ..........................
        List list = new ArrayList();
        HashMap targeting = new HashMap();
        targeting.put("logical",Targeting.OR_LOGICAL_OPERATOR);
        targeting.put("type",Targeting.GEO_CONTINENT_LIMITATION);
        targeting.put("comparison",Targeting.CONTAINS_OPERATOR);
        targeting.put("data",Targeting.CONTINENTS[1]);
        list.add(targeting);

        ...........................

        map.put("aTargeting",list);

        proxy.setTargeting(bannerID,list);

alt text