How to extract key in conversion action snippet tags

110 views
Skip to first unread message

san...@knorex.com

unread,
May 9, 2022, 12:26:54 AM5/9/22
to Google Ads API and AdWords API Forum
Hi,
I am getting conversion action detail, able to get below info:

"tagSnippets" : [
        {
            "eventSnippet" : "<!-- Event snippet for Sign up conversion page\nIn your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->\n<script>\nfunction gtag_report_conversion(url) {\n  var callback = function () {\n    if (typeof(url) != 'undefined') {\n      window.location = url;\n    }\n  };\n  gtag('event', 'conversion', {\n      'send_to': 'AW-758258222/icIRCO6E2MkBEK60yOkC',\n      'value': 1.0,\n      'currency': 'USD',\n      'event_callback': callback\n  });\n  return false;\n}\n</script>\n",
            "globalSiteTag" : "<!-- Global site tag (gtag.js) - Google Ads: 758258222 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-758258222\"></script>\n<script>\n  window.dataLayer = window.dataLayer || [];\n  function gtag(){dataLayer.push(arguments);}\n  gtag('js', new Date());\n\n  gtag('config', 'AW-758258222');\n</script>\n",
            "pageFormat" : "HTML"
        },
        {
            "eventSnippet" : "\"C_WiLQEGJl7rc\": {\n  \"on\": \"click\",\n  \"selector\": \"CSS_SELECTOR\",\n  \"vars\": {\n    \"event_name\": \"conversion\",\n    \"value\": 1.0,\n    \"currency\": \"USD\",\n    \"send_to\": [\"AW-758258222/icIRCO6E2MkBEK60yOkC\"]\n  }\n}\n",
            "globalSiteTag" : "<!-- Global site tag (gtag) - Google Ads: 758258222 -->\n<amp-analytics type=\"gtag\" data-credentials=\"include\">\n<script type=\"application/json\">\n{\n  \"vars\": {\n    \"gtag_id\": \"AW-758258222\",\n    \"config\": {\n      \"AW-758258222\": {\n        \"groups\": \"default\"\n      }\n    }\n  },\n  \"triggers\": {\n  }\n}\n</script>\n</amp-analytics>\n",
            "pageFormat" : "AMP"
        }
    ],

However eventSnippet is in string.
Then is there any query or solution to extract value of "send_to"?
I would like to get "AW-758258222/icIRCO6E2MkBEK60yOkC" from converision action detail.

Google Ads API Forum Advisor

unread,
May 10, 2022, 5:59:37 AM5/10/22
to san...@knorex.com, adwor...@googlegroups.com

Hi,
 

Thanks for reaching out to the Google Ads API Support team.
 

With regard to your concern, so our team can better check this concern, could you provide the complete Ads API logs (request and response with request-id) to further investigation on this?
 

You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.
 

Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aqtxo:ref

SJ Sagar

unread,
Sep 6, 2022, 1:34:00 AM9/6/22
to Google Ads API and AdWords API Forum
Hi, 

Please Help me how can I get this snippet code.

Google Ads API Forum Advisor

unread,
Sep 6, 2022, 2:17:03 AM9/6/22
to sagarji...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us. I am Sherwin from Google Ads API support team and I hope that you are doing well today.

Upon checking on the thread, it seems like my colleague Ernie already answered your question. Please check the message he sent below:

  • Please note that the only field that can be used to extract tag snippets of the conversion action is the conversion_action.tag_snippets field. With this, I am afraid that there is no way to extract the value from the 'send_to' field alone. You will need to create a process on your end where you will separate the said value from the returned response of the API.

Please let us know if you have other concerns.

Kind regards,
Google Logo
Sherwin Vincent
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aqtxo:ref

SJ Sagar

unread,
Sep 6, 2022, 9:08:52 AM9/6/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com
Hii sherwin

Hope you are well

Thanks for replying me

Can we get snippet code at the time of creating conversation by its response


Thanks 

Google Ads API Forum Advisor

unread,
Sep 6, 2022, 10:24:05 AM9/6/22
to sagarji...@gmail.com, adwor...@googlegroups.com
Hi SJ,

Thank you for your reply. 

Unfortunately, the tag_snippets (output only) would not be included in the response right after creating the conversion action. Even if the MUTABLE_RESOURCE setting is used, it will only allow for returning the mutable attributes or fields.

You would need to perform a separate request using the conversion_action report to extract its associated conversion_action.tag_snippets.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aqtxo:ref

SJ Sagar

unread,
Sep 6, 2022, 2:28:31 PM9/6/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com
Thank you for your response. 

SJ Sagar

unread,
Sep 6, 2022, 3:15:57 PM9/6/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com
hii sherwin

Hope you are well

as you said I tried to take tag_snippets using report but it get unidentified response

Response is --> Error occurred during parsing: Error occurred during parsing: Fail to push limit.

Please help
Reply all
Reply to author
Forward
0 new messages