INVALID_OPERAND_TYPE on service CampaignCriterionService using method mutate to bid modify LocationGroups

95 views
Skip to first unread message

Nick Harris

unread,
Jun 27, 2017, 8:14:16 PM6/27/17
to AdWords API Forum
In v201705, I'm trying to use the CampaignCriterionService to bid modify a LocationGroups object, but I'm getting an INVALID_OPERAND_TYPE error.

I can bid modify Location and Proximity objects no problem, just not LocationGroups.

Here is the log for the failed attempt to bid modify a LocationGroups:

[2017-06-27 17:04:09] local.WARNING: clientCustomerId=************ operations=1 service=CampaignCriterionService method=mutate responseTime=220 requestId=000552f9ec5620780a37dd1d7405b002 server=adwords.google.com isFault=1 faultMessage=[FunctionError.INVALID_OPERAND_TYPE @ operations[0].operand.criterion.matchingFunction.lhsOperand; trigger:'[IncomeOperand{tier=TIER_6_TO_10}]']  
[2017-06-27 17:04:09] local.NOTICE: POST /api/adwords/cm/v201705/CampaignCriterionService?wsdl HTTP/1.1
Connection: close
User-Agent: PHP-SOAP/7.0.18-0ubuntu0.16.04.1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 957
Authorization: REDACTED

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201705" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><ns1:RequestHeader><ns1:clientCustomerId>************</ns1:clientCustomerId><ns1:developerToken>REDACTED</ns1:developerToken><ns1:userAgent>unknown (AwApi-PHP, googleads-php-lib/27.1.0, PHP/7.0.18-0ubuntu0.16.04.1)</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:partialFailure>false</ns1:partialFailure></ns1:RequestHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns1:mutate><ns1:operations><ns1:operator>SET</ns1:operator><ns1:operand><ns1:campaignId>856494422</ns1:campaignId><ns1:criterion xsi:type="ns1:LocationGroups"><ns1:id>75227837396</ns1:id></ns1:criterion><ns1:bidModifier>2.69</ns1:bidModifier></ns1:operand></ns1:operations></ns1:mutate></SOAP-ENV:Body></SOAP-ENV:Envelope>

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=UTF-8
Date: Wed, 28 Jun 2017 00:04:09 GMT
Expires: Wed, 28 Jun 2017 00:04:09 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Accept-Ranges: none
Vary: Accept-Encoding
Connection: close

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201705"><requestId>000552f9ec5620780a37dd1d7405b002</requestId><serviceName>CampaignCriterionService</serviceName><methodName>mutate</methodName><operations>1</operations><responseTime>220</responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>[FunctionError.INVALID_OPERAND_TYPE @ operations[0].operand.criterion.matchingFunction.lhsOperand; trigger:'[IncomeOperand{tier=TIER_6_TO_10}]']</faultstring><detail><ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201705"><message>[FunctionError.INVALID_OPERAND_TYPE @ operations[0].operand.criterion.matchingFunction.lhsOperand; trigger:'[IncomeOperand{tier=TIER_6_TO_10}]']</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="FunctionError"><fieldPath>operations[0].operand.criterion.matchingFunction.lhsOperand</fieldPath><fieldPathElements><field>operations</field><index>0</index></fieldPathElements><fieldPathElements><field>operand</field></fieldPathElements><fieldPathElements><field>criterion</field></fieldPathElements><fieldPathElements><field>matchingFunction</field></fieldPathElements><fieldPathElements><field>lhsOperand</field></fieldPathElements><trigger>[IncomeOperand{tier=TIER_6_TO_10}]</trigger><errorString>FunctionError.INVALID_OPERAND_TYPE</errorString><ApiError.Type>FunctionError</ApiError.Type><reason>INVALID_OPERAND_TYPE</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>



Peter Oliquino

unread,
Jun 28, 2017, 5:39:08 AM6/28/17
to AdWords API Forum
Hi Nick,

As of v201702 of the AdWords API, the IncomeOperand can no longer be used as a FunctionArgumentOperand for LocationGroups. When passed as a new operand via the ADD mutate request to the services such as the CampaignCriterionService, AdGroupFeedService, CampaignFeedService, and CustomerFeedService, it will result in the same FunctionError.INVALID_OPERAND_TYPE error that you encountered.

However, I will review with the team regarding your scenario if this is indeed the expected behavior since you used SET instead of the ADD operator.

Thanks and regards,
Peter
AdWords API Team

Nick Harris

unread,
Jun 28, 2017, 11:34:08 AM6/28/17
to AdWords API Forum
Thank you for looking into this. I indeed did use the SET operator on an existing LocationGroups within a campaign.

I am following the example from https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201705/CampaignManagement/SetBidModifier.php 

In the same campaign, I am able to use the SET operator to mutate Location and Proximity without issue.

This is how the campaign locations appear in adwords (see that I've used the API to bid adjust all Location and Proximity 20%):

Nick Harris

unread,
Jun 28, 2017, 3:00:36 PM6/28/17
to AdWords API Forum
Peter - please do let me know what you and the team find. It certainly seems like if a LocationGroups is present in Adwords, we should be able to use the SET operator to bid modify it without running into the INVALID_OPERAND_TYPE error. If this is not the case, why do LocationGroups still even exist as Campaign Criterion? There has to be a way to make this work!


On Wednesday, June 28, 2017 at 2:39:08 AM UTC-7, Peter Oliquino wrote:

Peter Oliquino

unread,
Jun 29, 2017, 1:34:57 AM6/29/17
to AdWords API Forum
Hi Nick,

As per my discussion with the team, the income targeting (using IncomeOperand as a FunctionArgumentOperand) for the LocationGroups criterion have been updated to "read-only" since version 201702 of the AdWords API. Meaning that starting from that version, any mutate requests involving this criterion with the IncomeOperand will now result into the FunctionError.INVALID_OPERAND_TYPE error.

I have informed the team of the discrepancy in the documentation and the changes should reflect when available. My apologies for the inconvenience.

Best regards,
Peter
AdWords API Team

Nick Harris

unread,
Jun 29, 2017, 4:20:41 PM6/29/17
to AdWords API Forum
Thanks for the update. It seems very strange that the latest API version doesn't let you bid adjust existing LocationGroups that you can bid adjust with in the Adwords interface (old and new).

I managed to get around this for now (until version sunsets in October) by mixing in some classes from the v201609 library just when dealing with LocationGroups:
use Google\AdsApi\AdWords\v201609\cm\CampaignCriterion;
use Google\AdsApi\AdWords\v201609\cm\CampaignCriterionOperation;
use Google\AdsApi\AdWords\v201609\cm\CampaignCriterionService;
use Google\AdsApi\AdWords\v201609\cm\LocationGroups
use Google\AdsApi\AdWords\v201609\cm\Operator;

Peter Oliquino

unread,
Jun 29, 2017, 10:52:00 PM6/29/17
to AdWords API Forum
Hi Nick,

Yes, for now you may use the old versions in order to proceed. However, please also note that the v201609 is due to sunset soon and you may need to create new LocationGroups (this time without the IncomeOperand function) if you wish to maintain them using the newer versions.

If you still wish to implement income based targeting, you may want to consult the AdWords Community Forum on how to setup demographic targeting via the AdWords UI. Let me know if this helps.

Thanks and regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages