How to change change bidding strategy from Manual CPC to Target ROAS via Adword API

1,009 views
Skip to first unread message

Faizan Zulfiqar

unread,
Jul 1, 2019, 8:33:21 AM7/1/19
to AdWords API and Google Ads API Forum
Hello

I want to change the bidding strategy of a campaign from Manual CPC to Target ROAS. My Question how i am going to change it via API. There is no example available in your provided in your SDK.
Also how can i test it on test accounts.

Google Ads API Forum Advisor Prod

unread,
Jul 2, 2019, 3:03:09 AM7/2/19
to adwor...@googlegroups.com
Hi Faizan,

I'm afraid we currently have no exact sample code of what you are looking for. Moving forward, in order to change the bidding strategy of your campaign to TargetRoasBiddingScheme, you can follow this AddCampaigns example (also available in other languages), except you would need to use the SET operator instead of the ADD one. You should also only pass the campaign fields you wish to modify.

In your code, you can add something similar to the Java code below :

BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.TARGET_ROAS);

TargetRoasBiddingScheme targetRoasBiddingScheme = new TargetRoasBiddingScheme();
targetRoasBiddingScheme.setTargetRoas((double)50); // this is required
biddingStrategyConfiguration.setBiddingScheme(targetRoasBiddingScheme);
campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);


As for using this bidding scheme in test accounts, I'm afraid that this is not possible due to the eligibility requirements

Thanks and regards,
Peter
Google Ads API Team

ref:_00D1U1174p._5001UCaNvx:ref

Faizan Zulfiqar

unread,
Jul 2, 2019, 3:46:53 AM7/2/19
to AdWords API and Google Ads API Forum
Hello Peter

your code really helped me.
But I can not go live without testing this code.
I need to meet the eligibility requirement of target roas on test accounts.
Please say you have the method.

Thank you

Google Ads API Forum Advisor Prod

unread,
Jul 2, 2019, 5:12:30 AM7/2/19
to adwor...@googlegroups.com
Hi Faizan,

You can try and implement conversion tracking using your test accounts. Once you have setup your conversion trackers, you could then try setting up the TargetRoas bidding scheme for your campaign. Let me know if this helps.

Faizan Zulfiqar

unread,
Jul 2, 2019, 7:37:10 AM7/2/19
to AdWords API and Google Ads API Forum
Hi

Unfortunately I do not have any website which i can connect to test account and can implement conversion tracking.
Any Other method for showing fake conversion ? 

Google Ads API Forum Advisor Prod

unread,
Jul 2, 2019, 11:35:55 PM7/2/19
to adwor...@googlegroups.com
Hi Faizan,

Could you confirm which step you are having issues with? Also, for test accounts, you may use dummy websites such as 'www.example.com'. Let me know if this helps.

Faizan Zulfiqar

unread,
Jul 3, 2019, 1:24:55 AM7/3/19
to AdWords API and Google Ads API Forum
Hi Peter.

In test account I have created campaign of Manual CPC, Now i want conversions to change it to Target Roas.
I am clueless how conversion can be achieve in test accounts campaign.

You told me about conversion tracking but when i went to conversion tracking it is giving me code to place in a website and i have no website to place

I am stucked here 
Please help

Google Ads API Forum Advisor Prod

unread,
Jul 3, 2019, 2:46:04 AM7/3/19
to adwor...@googlegroups.com

Hi Faizan,

Could you confirm which exact step in this guide you are encountering an issue with? You can refer to this sample code (also available in other languages) on how to create your conversion tracker.

Additionally, I would like to note that the eligibility requirements for using the TargetRoasBiddingScheme would not be met when using test accounts as one of its conditions is that your Search or Display campaigns should already have at least 15 conversions in the past 30 days.



Thanks and regards,
Peter
Google Ads API Team



ref:_00D1U1174p._5001UCaNvx:ref

Faizan Zulfiqar

unread,
Jul 3, 2019, 5:46:01 AM7/3/19
to AdWords API and Google Ads API Forum


I have created the conversion tracker as mentioned in the guide. Now where to put the code provided by the example.

you are saying we can not track conversion in campaign created from test accounts ?

Google Ads API Forum Advisor Prod

unread,
Jul 3, 2019, 6:26:03 AM7/3/19
to adwor...@googlegroups.com
Hi Faizan,

Yes, you still would not be able to apply the TargetRoasBiddingScheme to your test account's campaigns. The examples I provided was for how you would implement the requirements into your production accounts in the event that you haven't done so yet.

Faizan Zulfiqar

unread,
Oct 14, 2019, 8:53:42 AM10/14/19
to AdWords API and Google Ads API Forum
hello

now I have more than 20 conversions in my campaign in 45 days.
When I am trying below code it is giving me error
here is my code
 $campaignService = $this->adWordsServices->get($this->sessionCampaignService::class);
        $campaign = new Campaign();       
        $campaign->setId($dbCampaign->adword_campaign_id);
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
        $biddingStrategyConfiguration->setBiddingStrategyType(
            BiddingStrategyType::TARGET_ROAS
        );
        $targetRoasBiddingScheme = new TargetRoasBiddingScheme('Target Roas Scheme');
        $targetRoasBiddingScheme->setTargetRoas((float)$dbCampaign->maargin->roas_percentage * 100);
        $biddingStrategyConfiguration->setBiddingScheme($targetRoasBiddingScheme);
        $campaign->setBiddingStrategyConfiguration($biddingStrategyConfiguration);
        // Create a campaign operation and add it to the list.

        $operation = new CampaignOperation();
        $operation->setOperand($campaign);
        $operation->setOperator(Operator::SET);
        $operations[] = $operation;

        // Update the campaign on the server.
        $result = $campaignService->mutate($operations);
        logger(print_r($result->getValue()[0],true));
        return $campaign = $result->getValue()[0];

below is my Request Soap XML

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
<SOAP-ENV:Header>
<ns1:RequestHeader>
<ns1:clientCustomerId></ns1:clientCustomerId>
<ns1:developerToken>REDACTED</ns1:developerToken>
<ns1:userAgent>Ads Tool CLient (AwApi-PHP, googleads-php-lib/37.1.0, PHP/7.2.8, ReportDownloader/string)</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:id>20*****38</ns1:id>
<ns1:biddingStrategyConfiguration>
<ns1:biddingStrategyType>TARGET_ROAS</ns1:biddingStrategyType>
<ns1:biddingScheme>
<ns1:BiddingScheme.Type>Target Roas Scheme</ns1:BiddingScheme.Type>
</ns1:biddingScheme>
</ns1:biddingStrategyConfiguration>
</ns1:operand>
</ns1:operations>
</ns1:mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and below is my response soap xml

<soap:Envelope
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: cvc-type.2: The type definition cannot 
be abstract for element ns1:biddingScheme. </faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>

Kindly advise what is going wrong

Thanks

Google Ads API Forum Advisor Prod

unread,
Oct 14, 2019, 10:46:40 PM10/14/19
to adwor...@googlegroups.com
Hi Faizan,

Could you try and update your code as seen below :

$targetRoasBiddingScheme = new TargetRoasBiddingScheme('Target Roas Scheme');  -->  $targetRoasBiddingScheme = new TargetRoasBiddingScheme();

Let me know if this helps resolve the Unmarshalling Error that you are encountering.

Faizan Zulfiqar

unread,
Oct 16, 2019, 1:11:56 AM10/16/19
to AdWords API and Google Ads API Forum
Hi

I have tried but the same error.
kindly advise.

Thank you

Google Ads API Forum Advisor Prod

unread,
Oct 16, 2019, 2:00:52 AM10/16/19
to adwor...@googlegroups.com

Hi Faizan,

Since this appears to be already more of a client library related issue, I would recommend that you reach out to the PHP client library owners instead, via this link, as they are better equipped to assist you regarding this matter.



Thanks and regards,
Peter
Google Ads API Team



ref:_00D1U1174p._5001UCaNvx:ref

Curtis Beck

unread,
Oct 31, 2019, 11:07:30 AM10/31/19
to AdWords API and Google Ads API Forum
Hi Faizan,

I came across this as I'm debugging my own issue. There are a couple things that stand out to me. First I don't see the actual target roas value you are trying to set in the SOAP message. I would expect something in the <ns1:biddingScheme> element. Looking at the your code, I see "maargin". Is that a typo and the value not being set?

Best of luck

Google Ads API Forum Advisor Prod

unread,
Oct 31, 2019, 3:02:48 PM10/31/19
to curti...@system1.com, adwor...@googlegroups.com
Hello, 

In addition to what Curtis mentioned, you will need to set the TargetRoas bidding strategy type. Please find the sample logs below:

<biddingStrategyConfiguration>  <biddingStrategyType>TARGET_ROAS</biddingStrategyType>
<biddingScheme xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns3:TargetRoasBiddingScheme"><ns3:targetRoas>1.0</ns3:targetRoas>
</biddingScheme>
</biddingStrategyConfiguration>

Let me know if you have any further questions. 

Thanks,
Bharani, Google Ads API Team



ref:_00D1U1174p._5001UCaNvx:ref
Reply all
Reply to author
Forward
0 new messages