AdWords
5.3K members online now
5.3K members online now
Improve your AdWords performance and boost your ROI, CTR, and Quality Score
Guide Me
star_border
Reply

Need an AdWords Script that returns keyword spend

Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

Hi.

 

I need a script that would execute something like this (on keyword level):

 

- cost > 100

- converted clicks = 0

- Date range: last 30 days

 

Anyone knows how to do it with script?

 

Thanks.

1 Expert replyverified_user
Marked as Best Answer.
Solution
Accepted by topic author Mate A
September 2015

Re: Need an AdWords Script that returns keyword spend

Top Contributor
# 2
Top Contributor

Hi @Mate A such a script is relatively simple, this should get you started:

 

function main() {
var keywords = AdWordsApp.keywords()
.withCondition("Cost > 100")
.withCondition("ConvertedClicks = 0")
.forDateRange("LAST_30_DAYS")
.get()

while(keywords.hasNext()) {
var thisKeyword = keywords.next();
Logger.log("Campaign: " + thisKeyword.getCampaign().getName() + ", AdGroup: " + thisKeyword.getAdGroup().getName() + ", Keyword: " + thisKeyword.getText());
}
}

 

Jon

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

Re: Need an AdWords Script that returns keyword spend

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆
Thanks @Jon_Gritton, exactly what I was looking for. Smiley Happy

Is there a way to this at MCC level?
Marked as Best Answer.
Solution
Accepted by topic author Mate A
September 2015

Re: Need an AdWords Script that returns keyword spend

Top Contributor
# 4
Top Contributor

Hi @Mate A yep, all you have to do is iterate through your Accounts and then call the script I've already provided in each iteration.  So you need to change the original function main() to be the iterator of the Accounts, then rename the existing function something else.  This should work.:

 

function main() {
//select the Account
var accIter = MccApp.accounts()
.get();
while (accIter.hasNext()) {
var theAccount = accIter.next();
MccApp.select(theAccount);
doKeywordCheck()

}
}

 

function doKeywordCheck() {
var keywords = AdWordsApp.keywords()
.withCondition("Cost > 100")
.withCondition("ConvertedClicks = 0")
.forDateRange("LAST_30_DAYS")
.get()

while(keywords.hasNext()) {
var thisKeyword = keywords.next();
Logger.log("Campaign: " + thisKeyword.getCampaign().getName() + ", AdGroup: " + thisKeyword.getAdGroup().getName() + ", Keyword: " + thisKeyword.getText());
}
}

 

You'll need to add this as a script at the MCC level.

 

If you need to choose only certain Accounts you could try adding a .withCondition to the Account selector that selects by names or by labels.

 

Jon

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

Re: Need an AdWords Script that returns keyword spend

Follower ✭ ✭ ☆
# 5
Follower ✭ ✭ ☆
@Jon_Gritton thank you very much.

Regards,
Mate

Re: Need an AdWords Script that returns keyword spend

Top Contributor
# 6
Top Contributor

No problem @Mate A let me know how you get on and please come back with any more questions you have.

 

Jon

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