AdWords
1.9K members online now
1.9K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Scripting Newbie Seeks Advice

[ Edited ]
Rising Star
# 1
Rising Star

Okay, I'm thinking scripts.

 

I want a script that will check some of the campaigns in one account, every four or five days, and make modest bid adjustments if the ads are positioning below where I want them. 

 

I found the pre-written Bid to Position script from the Developers site and it almost does what I want.

 

My problem is "some of the campaigns."  This script pulls keywords from all the campaigns, and that doesn't work for me.

 

The campaigns I want acted on are identified by a common label, so I figured I could add a restriction, but then I realized that the script acts on keywords but the condition I want to set exists only at the campaign level. 

 

Is that a problem?  I can't figure out how to add a campaign condition, so I'm assuming it is?

 

Do I have to go in to my keywords and add the label to each of them?

 

After that, I need to put the label limitation into the script itself. I thought I could use this string, which I found on the Scripts forum:

 

withCondition("LabelNames CONTAINS_XXXX").
get();

 

However, I'm not sure where to put it in the pre-written script?

 

 


Theresa
Google AdWords Top Contributor
*~*~*~*~*~*~*~*
4 Expert replyverified_user

Re: Scripting Newbie Seeks Advice

Top Contributor
# 2
Top Contributor
Hi Theresa,

I don't know much about AdWords scripts, but I do know Javascript. There are 2 functions in the script, raiseKeywordBids() and lowerKeywordBids(). I would add the .withCondition("LabelNames CONTAINS_XXXX") at the end of the other .withCondition statements. Example:

function raiseKeywordBids() {
// Condition to raise bid: Average position is greater (worse) than
// target + tolerance
var keywordsToRaise = AdWordsApp.keywords()
.withCondition("Status = ENABLED")
.withCondition("AveragePosition > " + (TARGET_AVERAGE_POSITION + TOLERANCE))
.withCondition("LabelNames CONTAINS_XXXX")
.orderBy("AveragePosition ASC")
.forDateRange("LAST_7_DAYS")
.get();

while (keywordsToRaise.hasNext()) {
var keyword = keywordsToRaise.next();
keyword.setMaxCpc(keyword.getMaxCpc() * BID_ADJUSTMENT_COEFFICIENT);
}
}

The .withCondition appears to be an "AND", it must meet all conditions.

Pete
petebardo -- Deadhead doing AdWords

Re: Scripting Newbie Seeks Advice

Top Contributor
# 3
Top Contributor
Hello, Theresa.

The only way I got it to work was this:

// Ad position you are trying to achieve.
var TARGET_AVERAGE_POSITION = 3;

// Once the keywords fall within TOLERANCE of TARGET_AVERAGE_POSITION,
// their bids will no longer be adjusted.
var TOLERANCE = 0.1;

// How much to adjust the bids.
var BID_ADJUSTMENT_COEFFICIENT = 1.05;

function main() {
processCampaigns();
}

function processCampaigns() {

var label = AdWordsApp.labels()
.withCondition('Name = "YOUR LABEL"')
.get().next();
var campaignIterator = label.campaigns().get();
while (campaignIterator.hasNext()) {
campaign = campaignIterator.next();
raiseKeywordBids();
lowerKeywordBids();
}

}

function raiseKeywordBids() {
// Condition to raise bid: Average position is greater (worse) than
// target + tolerance
var keywordsToRaise = campaign.keywords()
.withCondition("Status = ENABLED")
.withCondition("AveragePosition > " + (TARGET_AVERAGE_POSITION + TOLERANCE))
.orderBy("AveragePosition ASC")
.forDateRange("LAST_7_DAYS")
.get();

while (keywordsToRaise.hasNext()) {
var keyword = keywordsToRaise.next();
keyword.setMaxCpc(keyword.getMaxCpc() * BID_ADJUSTMENT_COEFFICIENT);
}
}

function lowerKeywordBids() {
// Conditions to lower bid: Ctr greater than 1% AND
// average position better (less) than target - tolerance
var keywordsToLower = campaign.keywords()
.withCondition("Ctr > 0.01")
.withCondition("AveragePosition < " + (TARGET_AVERAGE_POSITION - TOLERANCE))
.withCondition("Status = ENABLED")
.orderBy("AveragePosition DESC")
.forDateRange("LAST_7_DAYS")
.get();


while (keywordsToLower.hasNext()) {
var keyword = keywordsToLower.next();
keyword.setMaxCpc(keyword.getMaxCpc() / BID_ADJUSTMENT_COEFFICIENT);
}
}

First find the labels, then get the campaigns and then, while iterating through campaigns, change the bids. Test it please, replace YOUR LABEL with whatever you need. Preview first Smiley Happy.
Calin Sandici, AdWords Top Contributor | Find me on: Google+ | Twitter | LinkedIn | myBlog
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Re: Scripting Newbie Seeks Advice

[ Edited ]
Rising Star
# 4
Rising Star

Thanks @petebardo and @AdWiser!

 

 This worked perfectly!


Theresa
Google AdWords Top Contributor
*~*~*~*~*~*~*~*

Re: Scripting Newbie Seeks Advice

Top Contributor
# 5
Top Contributor

What's going on here @Theresa_Zook @AdWiser @petebardo ?  You guys trying to muscle in on my "script King" dominance? Smiley Happy

 

Just as some added advice, in my own version of this script I used a slightly modified way of testing the existing position.  The problem I found was that if you only ever test the "LAST_7_DAYS", when you increase or decrease bids the Keyword could have already reached the desired position "today" but the last 7 days stats still show it too low or too high so the bid gets adjusted again.  This then means the Keyword ends up too high or too low so the script starts adjusting the bid in the other direction and the process can end up "yo-yoing" too much.

 

Rather than rely only upon the last 7 days I also look at the stats for "YESTERDAY" and then weight the position to give a more balanced view of how it's doing and this tends to reduce the yo-yo effect.

 

My version also takes into Account ROAS and allows Keywords to occupy one of 3 different position "ranges" depending upon their performance, which works well when you've got enough data.

 

Jon

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

Re: Scripting Newbie Seeks Advice

[ Edited ]
Top Contributor
# 6
Top Contributor

When the King's away, Your Highness ... Smiley Happy

 

Later edit: I must confess I've only noticed the last link in the signature now. Oh, the nerve some people have, to barge in on script threads and lay their unskilled hands on them Smiley Happy

Calin Sandici, AdWords Top Contributor | Find me on: Google+ | Twitter | LinkedIn | myBlog
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Re: Scripting Newbie Seeks Advice

Rising Star
# 7
Rising Star

Have to admit, @Jon_Gritton, that I was surprised when you weren't the first to answer this--when you didn't post a response at all!  Smiley Happy

 

In fact, although I loaded & previewed the script, I haven't activated it yet, for the very reason you mention. I'm concerned that a 7-day interval is just too long--and performance varies so much on weekends that I'd rather not factor Sat-Sun into the equation.

 

At the same time, "yesterday" by itself isn't long enough.

 

In my saved draft of the script, I settled on "last business week" as the interval to check , thinking I'd run the script on Sunday mornings--but I'm still not quite sure that's right..

 

I also deleted the "lower bid" portion of the script. My best keywords are converting very cost-effectively, even with high positioning, so any bid lowering that needs to be done, I'd rather do manually.  

 

At the same time, obviously, I'd rather not pay to have most of my ads positioning a lot higher than what I've determined is the most profitable "range" so, back to the original subject, I'd prefer not to keep increasing bids when recent positioning is good.

 

~*~*~*~*~

 

Don't let Jon fool you, @AdWiser!  I emailed him about this project months ago, offering him money if he'd do my thinking for me. He totally blew me off--didn't even answer the email.

 

I think his signature is just his way of bragging that he knows something most of us don't.  Smiley Very Happy

 

Or, you know, at the time, I just assumed he and I weren't speaking and I hadn't been told....

 


Theresa
Google AdWords Top Contributor
*~*~*~*~*~*~*~*

Re: Scripting Newbie Seeks Advice

Top Contributor
# 8
Top Contributor
I simply cannot believe this story, @theresa_Zook Smiley Wink. Not today, anyway. This cannot be the King we elected. Erm, nominated. Oh well, tolerated Smiley Wink.
Calin Sandici, AdWords Top Contributor | Find me on: Google+ | Twitter | LinkedIn | myBlog
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Re: Scripting Newbie Seeks Advice

Rising Star
# 9
Rising Star

"Accepted, not at all grudgingly, but still with a private vow to keep a close eye on his future behavior...."

 

 


Theresa
Google AdWords Top Contributor
*~*~*~*~*~*~*~*

Re: Scripting Newbie Seeks Advice

Top Contributor
# 10
Top Contributor

@Theresa_Zook you should know by now that if you post something after 5pm UK time you're unlikely to get an answer from me... Smiley Happy

 

I think the script is worth pursuing.  I use my version(s) in all my client Accounts and I've never seen any reason to worry about them.  They're most useful in "watching" fluctuations due to competition or season so you don't have to worry that that bid you used 2 months ago now has your client Ads wallowing around position #6 (or constantly at #1.0).  One of my long-term clients is just coming into their busy season and their bids can end up double what they are in the low season so without the script I'd have to be making constant changes to make sure they catch the wave.  As it is, I can sit back and know that the script will manage it all for me, which is nice.

 

There's no reason you shouldn't use a script that just acts as a "boundary" checker, without being too precise.  You could set it up so it simply lowers bids on position #1.0 and raises them on a given low position (e.g. #4.0).  This would then allow you your own control between these two points and give you the sort of security I describe above.

 

Jon

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