I'm using the latest (v7) Google Ads API to upload offline conversions for Google Ads, using the Python Client Library. This is the standard code I'm using:

import os from google.ads.googleads.client import GoogleAdsClient client = GoogleAdsClient.load_from_env(version='v7') def process_adwords_conversion(     conversion_date_time,      gclid,      conversion_action_id,      conversion_value ):     conversion_date_time = convert_datetime(conversion_date_time)     customer_id = os.environ['GOOGLE_ADS_LOGIN_CUSTOMER_ID']     click_conversion = client.get_type("ClickConversion")     conversion_action_service = client.get_service("ConversionActionService")     click_conversion.conversion_action = (         conversion_action_service.conversion_action_path(             customer_id, conversion_action_id         )     )     click_conversion.gclid = gclid     click_conversion.conversion_value = float(conversion_value)     click_conversion.conversion_date_time = conversion_date_time     click_conversion.currency_code = "USD"     conversion_upload_service = client.get_service("ConversionUploadService")     request = client.get_type("UploadClickConversionsRequest")     request.customer_id = customer_id     request.conversions = [click_conversion]     request.partial_failure = True     conversion_upload_response = (         conversion_upload_service.upload_click_conversions(             request=request,         )     )     uploaded_click_conversion = conversion_upload_response.results[0]     print(conversion_upload_response)     print(         f"Uploaded conversion that occurred at "         f'"{uploaded_click_conversion.conversion_date_time}" from '         f'Google Click ID "{uploaded_click_conversion.gclid}" '         f'to "{uploaded_click_conversion.conversion_action}"'     )     return False 

I believe the code is fine, but I'm having problems locating the conversion_action_id value to use. In the Google Ads UI there's a screen listing the different Conversion Actions, with no sign of an ID anywhere. You can click on the name and get more details, but still no ID:

The conversion action detail screen in Google Ads UI

I've tried the following:

  1. Using the ocid, ctId, euid, __u, uscid, __c, subid URL parameters from this detail page as the conversion_action_id. That always gives an error:
partial_failure_error {   code: 3   message: "This customer does not have an import conversion action that matches the conversion action provided., at conversions[0].conversion_action"   details {     type_url: "type.googleapis.com/google.ads.googleads.v7.errors.GoogleAdsFailure"     value: "\n\305\001\n\003\370\006\t\022dThis customer does not have an import conversion action that matches the conversion action provided.\0320*.customers/9603123598/conversionActions/6095821\"&\022\017\n\013conversions\030\000\022\023\n\021conversion_action"   } } 
  1. Using the standard Google answer:

https://support.google.com/google-ads/thread/1449693/where-can-we-find-google-ads-conversion-ids?hl=en

Google suggests creating a new Conversion Action and obtaining the ID in the process. Unfortunately their instructions don't correspond to the current UI version, at least for me. The sequence I follow is:

  • Click the + icon on the Conversion Actions page
  • Select "Import" as the kind of conversion I want
  • Select "Other data sources or CRMs" then "Track conversions from clicks"
  • Click "Create and Continue"

I then get the screen:

Screen following Conversion Action creation

The recommended answer says:

The conversion action is now created and you are ready to set up the tag to add it to your website. You have three options and the recommended answer in this thread is discussing the Google Tag Manager option, which is the only option that uses the Conversion ID and Conversion Label. If you do not click on the Google Tag Manager option you will not be presented with the Conversion ID and Conversion Label.

Not so! What three options? The first "Learn more" link mentions the Google Tag Manager, but in the context of collecting the GCLID, which I already have. The "three options" mentioned in the official answer have gone. Clicking "done" simply takes me back to the Conversion Actions listing.

  1. Using the REST API

I've tried authenticating and interrogating the endpoint:

https://googleads.googleapis.com/v7/customers/9603123598/conversionActions/

hoping that would give a list of conversion actions, but it doesn't. It just gives a 404.

Does anybody know a way of getting the Conversion Action ID, either from the UI or programmatically (via client library, REST or some other method)?

Thanks!

Tag:google-ads-api

10 comments.

  1. Dmytro Chaban

    If you're using Python, you can list your conversions via next snippet:

    ads: GoogleAdsServiceClient = client.get_service('GoogleAdsService') pages = ads.search(query="SELECT conversion_action.id, conversion_action.name FROM conversion_action", customer_id='YOUR_MCC_ID') for page in pages: print(page.conversion_action)

    You can also open conversion action in UI and locate &ctId=, that's the conversion action id.

    1. Elad Benda

      When there is no date range in the query, how back in time does it go? How can I extend the time to get data?

    2. Dmytro Chaban

      Hey Elad, I think the query represents only what you have in your conversion settings. It's not the conversions itself, but just a config that you can set up on UI. So when you set up a new conversion, and want to get ID programmatically, this query will work. For deleted conversions, sadly I'm not sure if it'll work

    3. Elad Benda

      Thanks, is there any API to get the same data as I would from the report? see: i.imgur.com/DBFo7so.png

  2. Ralf Zosel

    I found this post with the solution how to get the Conversion Action ID:

    (…) I found out that conversionActionId can be found also in Google Ads panel. When you go to conversion action details, in URL there is parameter "ctId=123456789" which represent conversion action id.

    By the way, I tried something similar and it's still not working, but with this Conversion Action ID I get a different "Partial Failure" message, at least.

    1. Simon Birrell

      Thanks a lot for that iink. As it happened, I've already tried the ctId parameter (see 1 above). Whether I use this parameter or just put a random number, I always get the same message: partial_failure_error { code: 3 message: "This customer does not have an import conversion action that matches the conversion action provided., at conversions[0].conversion_action"}

    2. Ralf Zosel

      I obviously read over your paragraph numbered as 1, sorry for that. I am looking for help now on the official Google Ads API Forum, too, see groups.google.com/g/adwords-api/c/vg1XZgCF-aw . Did you solve your problem meanwhile?

    3. Simon Birrell

      Thanks for the help. No, I haven’t found a way round the problem. Between the multiple versions of the API and the poor documentation, this simple project has become a major headache.

    4. Simon Birrell

      No fix yet, but I've found out a bit more. First, the Google Tag Manager option does appear, but ONLY if you select website conversions in the first step. Second, the post you linked to before saying that ctld parameter is the conversion ID is definitely wrong. I created a website conversion action and got the ID from Tag Manager. It doesn't correspond to the ctld value at all. All of this hasn't helped - I still get the same partial error saying "This customer does not have an import conversion action that matches the conversion action provided."

  3. Gediminas

    At least in Google Ads API (REST) v10,
    it works if field conversionAction is set with value:
    'customers/{customerId}/conversionActions/{ctId}'
    customerId - without hyphens
    ctId - conversion action id, as mentioned in above comments,
    taken from GET parameters in Google Ads panel when specific conversion is opened.
    Can also be found programmatically with API method.

Add a new comment.