Geo-targeting with the openx API
I am using the openx api to insert advertisers/campaigns/banners but I cannot seem to find any documentation on geo-targeting a campaign or banner via the API. Can this be done, or am I going to have to start inje开发者_如何学运维cting directly into the database.
I did not find anything in the documentation either, however I was able to find how to do it.
Below is the java code. I used the method setBannerTargeting from BannerXmlRpcService.php.
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);
精彩评论