AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

Conversion Stats at Adwords Scripts

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hey Everyone,

 

I tried a script to pause bad performing Keywords. I used Clicks and Conversions to pause the Keywords. By checking the Results i saw that the script is taking the ClickConversions and not the Conversions. I need the Conversions(All) and not the ClickConversions. Is there any way to get it? Or why Adwords doesn't support (All)Conversions, (All) CR or ConversionsValue?

 

Thanks a lot for answers!

 

Cathi

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by Jon_Gritton (Top Contributor)
April 2016

Re: Conversion Stats at Adwords Scripts

Explorer ✭ ☆ ☆
# 2
Explorer ✭ ☆ ☆

Hello Cathi.

The answer is yes, but not through the AdWordsApp.Stats calss, if that's what you were using.
Adwords "getConversions()" method was deprecated:
https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_stats#getConversi...

 

However, you can still get a keywords conversions (NOT converted clicks), with the AdWordsApp.​Report, like so:

var keywordIterator = AdWordsApp.report("Select Conversions from KEYWORDS_PERFORMANCE_REPORT DURING LAST_30_DAYS");

You can change the DURING to other time periods or remove it completely for all time performance.

The results are returned in rows, each row for each result, so you can get them using the rows() method:

 

 var rows = keywordIterator.rows();
 
while (rows.hasNext()) {
  var row = rows.next();
var keywordConversions = row["Conversions"];
Logger.log(keywordConversions);
}

Additional info:

https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_report


Let me know if that worked for you, and if you need any other assistance.


View solution in original post

Marked as Best Answer.
Solution
Accepted by Jon_Gritton (Top Contributor)
April 2016

Re: Conversion Stats at Adwords Scripts

Explorer ✭ ☆ ☆
# 2
Explorer ✭ ☆ ☆

Hello Cathi.

The answer is yes, but not through the AdWordsApp.Stats calss, if that's what you were using.
Adwords "getConversions()" method was deprecated:
https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_stats#getConversi...

 

However, you can still get a keywords conversions (NOT converted clicks), with the AdWordsApp.​Report, like so:

var keywordIterator = AdWordsApp.report("Select Conversions from KEYWORDS_PERFORMANCE_REPORT DURING LAST_30_DAYS");

You can change the DURING to other time periods or remove it completely for all time performance.

The results are returned in rows, each row for each result, so you can get them using the rows() method:

 

 var rows = keywordIterator.rows();
 
while (rows.hasNext()) {
  var row = rows.next();
var keywordConversions = row["Conversions"];
Logger.log(keywordConversions);
}

Additional info:

https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_report


Let me know if that worked for you, and if you need any other assistance.


Re: Conversion Stats at Adwords Scripts

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hey Arik,

thanks for your answer! It helps a lot!

I used the rows method and got the conversions. Now i wanna used it to pause and lable my Keywords ( i wanna use the "AdWordsApp.adGroups",but adwords said my second adwords.app is not defined. Is a second Adwords.App not allowed? Or is there a better way?).

The following script is not finished, its just the first idea:

"
function main() {
getkeywords();
}

function getkeywords(){
var keywordIterator = AdWordsApp.report("SELECT Conversions,Criteria, AdGroupName,Clicks FROM KEYWORDS_PERFORMANCE_REPORT WHERE Clicks = 10 DURING LAST_14_DAYS");

var rows = keywordIterator.rows();
while (rows.hasNext()) {
var row = rows.next();
var keywordConversions = row["Conversions"]
var keywordCampaign = row["AdGroupName"]
var keywordCriteria = row["Criteria"];


if (keywordConversions < 10) {
lable(keywordCampaign, keywordCriteria);
}
}
}

function lable(campaign, keyword) {
var keywords = AdwordsApp.keywords();
Logger.log(campaign)
Logger.log(keyword);

}
"

Thanks a lot!

Re: Conversion Stats at Adwords Scripts

Explorer ✭ ☆ ☆
# 4
Explorer ✭ ☆ ☆

Hi Cathi.

It's undefined because you didn't get the keywords, by using the get() method.
Your line is:
var keywords = AdwordsApp.keywords();
where it should be:

var keywords = AdWordsApp.keywords().get();

 
But before you use that, you should define which keyword you want, by using the withCondition method, otherwise you're literally fetching all the account's keywords every call to function "lable".
Check it here:
https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_keywordselector#w...

 

Can you basically summarize what you are trying to achieve?
First, I see you selected the keywords that got 10 clicks even:

"WHERE Clicks = 10"
I'm not sure if that's what you were aiming at?

Second, you want to pause and label keywords that _______ ?

what's the condition here, less than 10 conversions?
"if (keywordConversions < 10)"

I'm sure something here is not set properly. I know I would never want to pause keywords that got 10 clicks and 8 (for example) conversions...

 

Re: Conversion Stats at Adwords Scripts

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hey,

The Conditions with "Clicks = 10" were just for example, it wasn't real, just for testing at the preview Mode.

At the Moment my script looks like:

"
function main(){
var keywordIterator = AdWordsApp.report("SELECT Conversions,Criteria, AdGroupName,Clicks FROM KEYWORDS_PERFORMANCE_REPORT WHERE Clicks >= 10 AND Conversions < 5 DURING LAST_14_DAYS");
var rows = keywordIterator.rows();

while (rows.hasNext()) {
var row = rows.next();
var keywordConversions = row["Conversions"]
var keywordCampaign = row["AdGroupName"]
var keywordCriteria = row["Criteria"];
Logger.log(keywordCriteria)
Logger.log(keywordCampaign)
Logger.log(keywordConversions);

var adGroupIterator = AdWordsApp.adGroups()
.withCondition('Name = '+keywordCampaign)
.get();

while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var keywordIterator = adGroup.keywords()
.withCondition('Text = '+keywordCriteria)
.get();

while (keywordIterator.hasNext()) {
var keyword = keywordIterator.next();
keyword.pause();
keyword.applyLabel('Bad Performance');
}
}
}
}
"
But Adwords said :"One of the conditions in the query is invalid." by the line with "var adGroupIterator = AdWordsApp.adGroups()".

Re: Conversion Stats at Adwords Scripts

Explorer ✭ ☆ ☆
# 6
Explorer ✭ ☆ ☆

Hi Cathi.

That's because your selection is not written properly format wise. Use double quotes at the beginning of the condition, and a single quote for the value of the condition:
Your line:

.withCondition('Name = '+keywordCampaign)

Should be:

.withCondition("Name = '"+keywordCampaign+"'")


Same for the keyword.



Also, you are using the Ad Group name as a condition which is not good, because Ad Group name is not unique. You can have 2 adgroups with the same name in 2 different campaigns (with different geo targeting, audiences, etc.). Use the adgroup Id instead:

  var keywordIterator = AdWordsApp.report("SELECT Id,Conversions,Criteria, AdGroupId, Clicks FROM KEYWORDS_PERFORMANCE_REPORT WHERE Clicks >= 10 AND Conversions < 5 DURING LAST_14_DAYS");
.........................
    var keywordAdGroupId = row["AdGroupId"];
    var keywordId = row["Id"];
.........................
    var adGroupIterator = AdWordsApp.adGroups()
    .withCondition("Id = '"+keywordAdGroupId+"'")
    .get();
.........................    
      var keywordIterator = adGroup.keywords()
      .withCondition("Id = '"+keywordId+"'")
      .get();

 

Lastly, you need to create a label before applying it. You can create it with the script, but since you are using the same label name each time you run the script, just create it once in Adwords before running the script.

If you wish to create a different label with every script run (maybe with a date for future reports), use these lines:

// RUN ONCE IN BEGINNING OF SCRIPT
  var today = new Date();
  var thisDay = today.getDate();
  var thisMonth = new Date().getMonth();
  thisMonth = thisMonth + 1;
  var thisYear = new Date().getFullYear();
  var fullDate = thisDay + '.' + thisMonth + '.' +thisYear

  var labelName = 'Bad Performance: ' + fullDate;
  AdWordsApp.createLabel(labelName, 'LABEL DESCRIPTION (Opt)', 'red');


.............................

// LATER INSIDE LOOP:
keyword.applyLabel(labelName);



Good Luck!

 

 

 

 

 

 

Re: Conversion Stats at Adwords Scripts

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Thank you! Everything is working well! Smiley Happy