Using LocationSearchParameter for TargetingIdeaService v201109

孤街浪徒 提交于 2019-12-11 11:15:59

问题


I am trying to use LocationSearchParameter with TargetingIdeaService (v201109). I am struggling with an Invalid_Criterion_ID error. May I request some help with that? Here is how I am setting LocationSearchParameter in php

$locationTargetParameter = new LocationSearchParameter(); 
$locationTargetParameter->locations=$LocArray; // $LocArray is array of IDs 2840 for US

回答1:


As of v201702. Here's a working example.

$loc = array();
$location = new location();
$location->setId(2840); // USA
$loc[]=$location;
$locationTargetParameter = new LocationSearchParameter();
$locationTargetParameter->setLocations($loc);
$searchParameters[] = $locationTargetParameter;

Also if you're copying the example file found here. Don't forget to include

use Google\AdsApi\AdWords\v201702\o\LocationSearchParameter;

Since this is needed for the LocationSearchParameter to work.

As for documentation and location IDs, check here.




回答2:


Here is what worked for me in case there are others looking to do the same thing:

 $loc = array();
 $location = new location();
 $location->id = '2840';
 $loc[]=$location;
 $locationTargetParameter = new LocationSearchParameter();
 $locationTargetParameter->locations=$loc;


来源:https://stackoverflow.com/questions/8887948/using-locationsearchparameter-for-targetingideaservice-v201109

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!