RE: retrieve cost data from performance max campaigns

748 views
Skip to first unread message

Google Ads Scripts Forum Advisor

unread,
Feb 11, 2022, 1:05:42 AM2/11/22
to adwords...@googlegroups.com

Hello Gabi,

 

Thank you for reaching out to the Google Ads Script support channel. I’m James, allow me to assist you further.

 

Could you please try to use the script below and let me know if you would be able to retrieve the expected Performance Max campaigns data from there?

var query = "SELECT segments.date, campaign.name WHERE segments.date DURING YESTERDAY";
var result = AdsApp.search(query);
  while (result.hasNext()) {
    var row = result.next();
    console.log(JSON.stringify(row));
  }

Otherwise, kindly provide us the following information below so that we can take a closer look at your issue?

  • Google Ads account ID / CID
  • Script name
  • Shareable link to template spreadsheet used in the script (if applicable)
  • Screenshot of the issue

 

You may send the following details above via ‘Reply privately to author’ option, if the private option is not available on your end, then please send it over through this email <googleadsscr...@google.com> instead. 

 

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2W5ztJ:ref

Blaise Reymondin

unread,
Feb 11, 2022, 8:19:00 AM2/11/22
to Google Ads Scripts Forum
Hi James

I experience the same problem here and did the test.

First thing I think you omitted the FROM clause in your example:

var query = "SELECT segments.date, campaign.name FROM campaign WHERE segments.date DURING YESTERDAY";

But then it only returns the 2 Search of my 3 actives campaigns:

11/02/2022 14:13:02
{"campaign":{"resourceName":"customers/6758978837/campaigns/6497286159","name":"CH/fr BOFU"},"segments":{"date":"2022-02-10"}}

11/02/2022 14:13:02
{"campaign":{"resourceName":"customers/6758978837/campaigns/6497458722","name":"CH/fr MOFU"},"segments":{"date":"2022-02-10"}}


It's like my third "Performance Max" campaign is ignored by the Google Ads API.

It becomes critical as a lot of scripts are not running currently, e.g. for evaluating total spending for the current month, etc. 

Hope it helps,
Blaise

gilp...@gmail.com

unread,
Feb 14, 2022, 4:58:06 AM2/14/22
to Google Ads Scripts Forum
@Blaise you said:

"It becomes critical as a lot of scripts are not running currently, e.g. for evaluating total spending for the current month, etc"

So how do I get scripts to work again? The simple script below worked perfecty for almost 3 years, and since January it's showing this error:

Feed-based extension is read-only for this extension type. ({"errorCode":{"feedError":"LEGACY_EXTENSION_TYPE_READ_ONLY"},"message":"Feed-based extension is read-only for this extension type.","trigger":{"stringValue":"[17]"},"location":{"fieldPathElements":[{"fieldName":"mutate_operations","index":0},{"fieldName":"extension_feed_item_operation"}]}})

I read on Google that they are migrating "feed-based" extensions to "asset-based" format (I have no idea what this is)... but there is absolutely no information how to do this "assect-based" using the Google Ads Script.

The code is below. As you can see it's pretty simple and it worked for years... Any suggestion how to make this work again?

function main() {

        var calloutBuilder = AdsApp.extensions().newCalloutBuilder();
        var calloutOperator = calloutBuilder.withText("Testando Teste").build();
   
        if (calloutOperator.isSuccessful()) {
   
                        Logger.log("Ok.");
                   
        }
        else{
   
                        Logger.log("Not Ok:" + calloutOperator.getErrors().join("\n"));
   
        }

}

Blaise Reymondin

unread,
Feb 14, 2022, 8:22:52 AM2/14/22
to Google Ads Scripts Forum
These are 2 different things. I misspoke: the problem with Performance Max campaigns is not that the scripts don't work, it's that the results are not correct since Perf Max campaigns are simply ignored in the results.

What you mention looks like a migration problem with the new G Ads scripts. Another thing.

Google Ads Scripts Forum Advisor

unread,
Feb 15, 2022, 5:16:06 AM2/15/22
to adwords...@googlegroups.com
Hi all,

I work along with James. Allow me to assist you in this.

As per performance max, you will need to add the advertising_channel_type = PERFORMANCE_MAX in order to get the campaign performance max.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2W5ztJ:ref

Blaise Reymondin

unread,
Feb 15, 2022, 5:49:41 AM2/15/22
to Google Ads Scripts Forum
Hi Teejay

Thank you for your intervention. 

But we get no row with advertising_channel_type containing value 'PERFORMANCE_MAX' when executing: 

 var query = "SELECT segments.date, campaign.name, campaign.advertising_channel_type FROM campaign WHERE segments.date DURING YESTERDAY";

  var result = AdsApp.search(query);
  while (result.hasNext()) {
    var row = result.next();
    console.log(JSON.stringify(row));
  }

 I got: 

15/02/2022 11:39:41
{"campaign":{"resourceName":"customers/6758978837/campaigns/6497286159","advertisingChannelType":"SEARCH","name":"CH/fr BOFU"},"segments":{"date":"2022-02-14"}}

15/02/2022 11:39:41
{"campaign":{"resourceName":"customers/6758978837/campaigns/6497458722","advertisingChannelType":"SEARCH","name":"CH/fr MOFU"},"segments":{"date":"2022-02-14"}}

The script only returns advertisingChannelType with 'SEARCH' values, despite there I got one PERFORMANCE_MAX campaign active in the account (see attached picture). 

Obviously adding a WHERE clause with advertising_channel_type = PERFORMANCE_MAX  would not create a not exisiting row ;-)

Hope it helps to understand the problem,
pmax.png

Kurt Henninger

unread,
Feb 16, 2022, 3:52:51 AM2/16/22
to Google Ads Scripts Forum
We have the exact same issue, current scripts "ignore" Performance Max campaigns entirely.

At a minimum, we really need to be able to pull spend out with a script.

adwords clientcenter

unread,
Feb 16, 2022, 7:04:20 AM2/16/22
to Google Ads Scripts Forum
same issue here, we need to pull cost and conversion value data for Performance Max campaigns.

Any news on how and when this is possible via   AdsApp.search  ?

Google Ads Scripts Forum Advisor

unread,
Feb 17, 2022, 1:32:14 AM2/17/22
to adwords...@googlegroups.com
Hi all,

Thank you for getting back to us.

The advertising_channel_type = PERFORMANCE_MAX filter should return the campaign max performance data. However, it appears that there's an issue o this which the team is currently under investigation. I'll update this thread the soonest the team provide their investigation findings.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2W5ztJ:ref

Maciej Ilczyszyn

unread,
Feb 18, 2022, 5:01:22 PM2/18/22
to Google Ads Scripts Forum
Hope you will a way, I'm also waiting for a way to pull data from Perf Max campaigns.

Google Ads Scripts Forum Advisor

unread,
Feb 21, 2022, 4:55:54 AM2/21/22
to adwords...@googlegroups.com

Hello Maciej,

 

Michael here and I work along with Teejay.

 

Thank you for reporting the same issue. Our team is already investigating this and rest assured that we will provide an update once we have received sufficient information on the investigation of our wider team.

Regards,

Google Logo
Michael Angelo
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2W5ztJ:ref

Luuk

unread,
Feb 24, 2022, 5:14:37 PM2/24/22
to Google Ads Scripts Forum
Hi,

My question seems to be very similar to the one posted here before, so therefore I'd like to join this conversation. Am I right if I say that currently the GAQL does not return impressions for the PERFORMANCE_MAX advertising_channel_type? I do get all other impressions per advertising_channel_type, but performance max is not in the report. Am I missing something or is this still in development?

Thanks,
Luuk

Op maandag 21 februari 2022 om 10:55:54 UTC+1 schreef adsscripts:

Google Ads Scripts Forum Advisor

unread,
Mar 1, 2022, 2:09:25 AM3/1/22
to adwords...@googlegroups.com

Hello Luuk,

Thank you for raising the same issue you’ve experienced on your end.

I confirm that there’s indeed an ongoing issue upon using GAQL for PERFORMANCE_MAX advertising_channel_type. However, our team is already aware of this and we are continuously working to fix this issue. Rest assured that someone from our team will update this thread.

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2W5ztJ:ref

Nils Rooijmans

unread,
Jun 7, 2022, 3:15:15 AM6/7/22
to Google Ads Scripts Forum
While researching Google Ads Scripts issues related to PMax campaigns I came across this thread.

Good news for future readers; this issue has been solved. You can use GAQL to retrieve data for PMax campaigns. Here's a code example:  


function main() {

  var nrOfCampaigns = 0;
   
  var query =
      "SELECT " +
      "campaign.name, campaign.advertising_channel_type, metrics.clicks " +
      "FROM campaign "+
      "WHERE campaign.status = ENABLED AND campaign.advertising_channel_type = PERFORMANCE_MAX AND segments.date DURING THIS_MONTH";
 
  try {

    var result = AdsApp.search(query);

    while (result.hasNext()) {
      var row = result.next();
      Logger.log("CampaignName: '"+row.campaign.name+"' , Clicks: "+row.metrics.clicks);
      nrOfCampaigns++;
    }
  } catch (e) {
   Logger.log("### ERROR: "+e);
  }
 
  Logger.log("\nNumber of enabled PMax campaigns: "+nrOfCampaigns);
}



Hope this helps the readers over here,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/

Google Ads Scripts Forum Advisor

unread,
Jun 7, 2022, 6:05:44 AM6/7/22
to adwords...@googlegroups.com

Hello,

I agree with Nils and excuse us for the late update on this. However, I confirm that this issue is now resolved. You can now retrieve performance max campaigns using Google Ads scripts reporting along with GAQL query, specifically with campaign resources

@Nils - Thank you for bumping this thread. We appreciate it!

Regards,

Reply all
Reply to author
Forward
0 new messages