AdWords
2.9K members online now
2.9K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

Creating a Script to Change Bids

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi I'm if anyone can give me any advice on how to write a script to change all of the bids in a campaign according to the following:

 

[£15 (value of a conversion)] X [All-time Conversion Rate for That KW] = The Max CPC for That KW

 

So essentially I want the bid for each keyword to be determined by the conversion rate of that keyword.

 

Any help would be much appreciated.

 

Thanks,

 

Philip

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Philip A
September 2015

Re: Creating a Script to Change Bids

Top Contributor
# 2
Top Contributor

Hi Philip, try the script below.  Please make sure you Preview the script before running it and check the Logs tab to ensure it's doing what you want it to do.  As with all scripts, you must take responsibility for any changes that it makes.

 

Jon

 

 

function main() {

// get all the active Keywords in the Account
var keywordsIter = AdWordsApp.keywords()
.withCondition("Status = ENABLED")
.withCondition("CampaignStatus = ENABLED")
.withCondition("AdGroupStatus = ENABLED")
.get();

while (keywordsIter.hasNext()) {
// step through each Keyword found
thisKeyword = keywordsIter.next();
// get the stats for all time
thisKWStats = thisKeyword.getStatsFor("ALL_TIME");
// get the conversion rate
var thisKWCR = thisKWStats.getClickConversionRate();
// only calculate or change CPC if CR > 0
if(thisKWCR > 0) {
var newCPC = 15 * thisKWCR;
thisKeyword.setMaxCpc(newCPC);
// output to Logs for debugging/testing
Logger.log(thisKeyword.getText() + ": CR:" + thisKWCR + ", New CPC:" + newCPC);
}
}
}

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Philip A
September 2015

Re: Creating a Script to Change Bids

Top Contributor
# 2
Top Contributor

Hi Philip, try the script below.  Please make sure you Preview the script before running it and check the Logs tab to ensure it's doing what you want it to do.  As with all scripts, you must take responsibility for any changes that it makes.

 

Jon

 

 

function main() {

// get all the active Keywords in the Account
var keywordsIter = AdWordsApp.keywords()
.withCondition("Status = ENABLED")
.withCondition("CampaignStatus = ENABLED")
.withCondition("AdGroupStatus = ENABLED")
.get();

while (keywordsIter.hasNext()) {
// step through each Keyword found
thisKeyword = keywordsIter.next();
// get the stats for all time
thisKWStats = thisKeyword.getStatsFor("ALL_TIME");
// get the conversion rate
var thisKWCR = thisKWStats.getClickConversionRate();
// only calculate or change CPC if CR > 0
if(thisKWCR > 0) {
var newCPC = 15 * thisKWCR;
thisKeyword.setMaxCpc(newCPC);
// output to Logs for debugging/testing
Logger.log(thisKeyword.getText() + ": CR:" + thisKWCR + ", New CPC:" + newCPC);
}
}
}

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Creating a Script to Change Bids

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks a lot for the help. I'll test this out.

Much appreciated Smiley Happy

Philip