How to access the All Conv.

92 views
Skip to first unread message

reporting info

unread,
Aug 22, 2023, 3:19:43 PM8/22/23
to Google Ads Scripts Forum
Hi,
I am trying to access the metric of All conv. but I can't find how to do it, could you help me with this?
Account ID: 280-950-0619
Script name: All conversions

Sigurd Fabrin

unread,
Aug 23, 2023, 5:10:54 AM8/23/23
to Google Ads Scripts Forum
You can find the metric in conversion_action, here https://developers.google.com/google-ads/api/fields/v14/conversion_action_query_builder

Example code that will log the sum of all conversions for each enabled conversion action in your account during the last 7 days:
function main() {
  const query =
    `SELECT
      metrics.all_conversions,
      conversion_action.name,
      conversion_action.origin,
      conversion_action.status,
      conversion_action.type
    FROM
      conversion_action
    WHERE
      segments.date DURING LAST_7_DAYS
      AND conversion_action.status = "ENABLED"`;
  const response = AdsApp.search(query);
  while (response.hasNext()) {
    const row = response.next();
    console.log(`all_conversions: ${row.metrics.allConversions}`);
    console.log(`conversion_action.name: ${row.conversionAction.name}`);
    console.log(`conversion_action.origin: ${row.conversionAction.origin}`);
    console.log(`conversion_action.status: ${row.conversionAction.status}`);
    console.log(`conversion_action.type: ${row.conversionAction.type}\n***\n`);
  }
}

Sigurd

Google Ads Scripts Forum Advisor

unread,
Aug 23, 2023, 2:38:56 PM8/23/23
to adwords...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads Scripts support team.

With regards to your concern, please note that there's no direct method under the AdsApp.​Stats (https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_stats) for all conversions. You may check this guide (https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_stats#methods:) for reference. 

That said, you may instead utilize reports (https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_report) in order to get allConversions data for ad-level. You may try creating a spreadsheet report by referring to this guide (https://developers.google.com/google-ads/scripts/docs/examples/reports#create-a-spreadsheet-report) and use the query below to get allConversions data for ad-level:
SELECT ad_group_ad.ad.id, 
ad_group_ad.ad.name, 
metrics.all_conversions, 
metrics.conversions, 
metrics.cost_micros, 
metrics.average_cpc, metrics.ctr 
FROM ad_group_ad

Let us know if you have further questions.
 
This message is in relation to case "ref:_00D1U1174p._5004Q2o7RDp:ref"

Thanks,
 
Google Logo Google Ads Scripts Team


reporting info

unread,
Aug 24, 2023, 5:49:55 PM8/24/23
to Google Ads Scripts Forum
Hi

This is perfect, but I don't see a way to solve my major issue, which is:
I'm trying to make the script evaluate certain parameters like CPC, CTR, and View Rate depending on the cost it has. However, the final condition is that if an ad reaches a cost equal to or greater than $30, it should evaluate whether it has had any Conversion Action of "ClickMagick - BeginCheckout." If it hasn't, the script should turn off the ad. While using the query is possible to access account-level Conversion Actions, I'm unsure how to access them at the ad level.

In the script titled "Fase 1 - Pause High CPC Ads," I already have the conditions that evaluate the initial metrics. And in the script named "Conversion Action BeginCheckout," I am accessing the conversions.

Account ID: 280-950-0619 

Google Ads Scripts Forum Advisor

unread,
Aug 25, 2023, 5:56:08 AM8/25/23
to adwords...@googlegroups.com

Hi,

 

Upon checking, I would recommend you approach this based on our team's previous response which is by building an ad_group_ad report <https://developers.google.com/google-ads/scripts/docs/features/reports#report_example> and including the metrics as well as filters for the final conditions you've mentioned. Kindly utilize it's interactive query builder <https://developers.google.com/google-ads/api/fields/v14/ad_group_ad_query_builder> for ease in building the report query. You can include them within the WHERE clause to filter on the conversion action ClickMagick - BeginCheckout as well as if their cost is greater than 30 so as to check if the ads meet the conditions. You can include the following fields:

  • segments.conversion_action (when filtering, you'll need to use it's resource name)
  • metrics.cost_micros (you will need to divide this by 1000000)
  • ad_group_ad.ad.id (you will need this for your selector below)

 

Once you've retrieved these ads, you can store the value for ad_group_ad.ad.id in a variable and input it within the withCondition() method of an AdSelector <https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_adselector>, and then you can use the pause() method. As an aside, it appears that conversion actions do not have levels, such that once you've accessed them using the specific entity's report type, it should be associated with the said entity.

 

Let us know if you have any clarifications. If this does not work for you, then kindly provide the step-by-step procedure, use-case or what you're aiming for with your script in bullet form so we're able to assist you further.

reporting info

unread,
Aug 29, 2023, 3:52:57 PM8/29/23
to Google Ads Scripts Forum
Hello

I am trying to create a report through a query, but I don't know how to access the ad parameters, I have the campaign report, but not for ads, can you help me with this?

Script Name: Conversion action BeginCheckout

Google Ads Scripts Forum Advisor

unread,
Aug 30, 2023, 2:16:52 PM8/30/23
to adwords...@googlegroups.com
Hi,

Thank you for returning to our team.

With regards to your concern, I've tried checking your script and I was able to get campaign-level data. You mentioned that you don't know how to access the ad parameters. That said, please note that the report you have in your script is specifically for pulling campaign-level data. If you want to pull ad-related data, then we would recommend using the ad_group_ad (https://developers.google.com/google-ads/api/fields/v14/ad_group_ad) report instead. You may use this ad_group_ad_query_builder (https://developers.google.com/google-ads/api/fields/v14/ad_group_ad_query_builder) that will surely help you building and validating your query.

If you encounter issues, then please feel free to get back to our team with the uncropped Google Ads UI screenshots so we can provide precise recommendations. You may send these privately via the Reply to author option. Note that you may need to join the Google Group for you to use this option. If this option is not available on your end still, you may send it through our email (googleadsscr...@google.com) instead.

reporting info

unread,
Aug 30, 2023, 6:12:31 PM8/30/23
to Google Ads Scripts Forum
I already have the report that accesses the ad-level parameters in the script called "All conversions," and in the script named, I have the code that accesses the required conversion action "Conversion action BeginCheckout." How can I retrieve the quantity of ClickMagick - BeginCheckout conversion actions for each ad?
Reply all
Reply to author
Forward
0 new messages