How to add Operating system version target to Campaign or Adgroup?

41 views
Skip to first unread message

Suresh Kumar

unread,
Jun 28, 2019, 6:17:27 AM6/28/19
to AdWords API and Google Ads API Forum
Hi,

Could you please help me to add a new operating system version target to a particular campaign or adgroup? I am able to add other targeting options but not operating system version.
I am using Java API. I am trying to add OperatingSystemVersion programmatically like below, assume that I set all other campaign properties,

OperatingSystemVersion osv = new OperatingSystemVersion();
    osv.setId(630153L);
    CampaignCriterion c = new CampaignCriterion();
    c.setCriterion(osv);
    campaignCriteria.add(c);

Following is the SOAP request,
<soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201809">
            <operations>
                <operator>ADD</operator>
                <operand>
                    <campaignId>2047907271</campaignId>
                    <criterion xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns2:Language">
                        <ns2:id>1000</ns2:id>
                        <ns2:code>en</ns2:code>
                        <ns2:name>English</ns2:name>
                    </criterion>
                    <campaignCriterionStatus>ACTIVE</campaignCriterionStatus>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand>
                    <campaignId>2047907271</campaignId>
                    <criterion xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns3:OperatingSystemVersion">
                        <ns3:id>630153</ns3:id>
                        <ns3:name>Apple iOS</ns3:name>
                    </criterion>
                    <campaignCriterionStatus>ACTIVE</campaignCriterionStatus>
                </operand>
            </operations>

            <operations>
                <operator>ADD</operator>
                <operand>
                    <campaignId>2047907271</campaignId>
                    <criterion xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns4:Language">
                        <ns4:id>1102</ns4:id>
                        <ns4:code>ms</ns4:code>
                        <ns4:name>Malay</ns4:name>
                    </criterion>
                    <campaignCriterionStatus>ACTIVE</campaignCriterionStatus>
                </operand>
            </operations>
</mutate>
    </soapenv:Body>

I am getting the following error,

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
            <requestId>00058c5ecddabd3c0a620013310b20cb</requestId>
            <serviceName>CampaignCriterionService</serviceName>
            <methodName>mutate</methodName>
            <operations>12</operations>
            <responseTime>279</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[1].operand.criterion; trigger:'SEARCH']</faultstring>
            <detail>
                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">
                    <message>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[1].operand.criterion; trigger:'SEARCH']</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="OperationAccessDenied">
                        <fieldPath>operations[1].operand.criterion</fieldPath>
                        <fieldPathElements>
                            <field>operations</field>
                            <index>1</index>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>operand</field>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>criterion</field>
                        </fieldPathElements>
                        <trigger>SEARCH</trigger>
                        <errorString>OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE</errorString>
                        <ApiError.Type>OperationAccessDenied</ApiError.Type>
                        <reason>OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE</reason>
                    </errors>
                </ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>


The above error was thrown only if I add operatingsystemversion as one of the operation, other options are working fine. Please provide some java code to add operatingsytemversion to campaign or adgroup.

Suresh

Google Ads API Forum Advisor Prod

unread,
Jun 28, 2019, 2:49:33 PM6/28/19
to ssuresh...@gmail.com, adwor...@googlegroups.com
Hello Suresh, 

Thank you for sharing the logs. They were really helpful. The error indicates that the campaign type does not support the OperatingSystemVersion criteria. The OperatingSystemVersion only supports targeting Display campaign. The criteria usage table should be helpful look up the criteria and the targeting possibilities. 

Let me know if you have any questions.

Regards,
Bharani, Google Ads API Team

ref:_00D1U1174p._5001UCZyrk:ref

Suresh Kumar Shenbagam

unread,
Jun 28, 2019, 11:48:50 PM6/28/19
to AdWords API and Google Ads API Forum
I found the answer, error gone after setting the AdvertisingChannelType to Display for a Campaign.
 Is if possible to set the AdvertisingChannelType to Search and Display. Please let me know

Google Ads API Forum Advisor Prod

unread,
Jul 1, 2019, 8:34:10 AM7/1/19
to suresh.s...@cloudsense.com, adwor...@googlegroups.com
Hello Suresh, 

I'm afraid it is not possible to set the Operating System as the targeting criteria for Search with Display Select campaigns. Please refer to the criteria usage table for more information on the supported campaign types. 

Thanks,
Reply all
Reply to author
Forward
0 new messages