Get Google Ads tracking script
<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>
Returns the gtag snippet that reports the app's conversions to Google Ads.
The snippet loads Google's tag, sets consent to denied for every purpose until the app grants it, captures the click ID from the landing URL into a first-party cookie once ad storage is granted, and reports a page view on each in-app route change. It carries the conversion ID of the first goal on the account whose tag Google has published, which covers every goal on that account.
Place the snippet once in the app's HTML rather than per page. Firing an individual conversion is separate. The app calls gtag('event', 'conversion', ...) at the moment the conversion happens, or you report it from the server with Upload Google Ads conversions.
<Note>This endpoint accepts a personal API key. Workspace API keys are not authorized for it and are rejected with a 403.</Note>
Path parameters
ID of the app whose Google Ads conversion tracking you want to manage.
ID of the app whose Google Ads conversion tracking you want to manage.
Response
The snippet to place in the app.
Example response
{
"script": "<script>\nwindow.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'AW-123456789', {'send_page_view': false});\n</script>"
}