问题
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