Posts tagged with gtag.js

I have set up a Google Ads campaign.

If users search "Cool Clothes" in Google, my campaign website will show in search results.

Now, the user will follow these steps:

  1. Click the campaign website link in the Google search result
  2. Go to https://cool-clothes.com/my-campaign
  3. The user wants to signup an account, so users click the "Sign Up" button
  4. I use Facebook for login, so users will redirect to https://facebook.com first, asking for some permissions.
  5. After permission granted, Facebook will redirect back to my website called https://cool-clothes.com/new-user
  6. https://cool-clothes.com/new-user is where I put the Google Ads tracking code

https://cool-clothes.com/new-user HTML looks like this:

<!DOCTYPE html> <html lang="en">   <head>     <meta charset="UTF-8" />     <meta http-equiv="X-UA-Compatible" content="IE=edge" />     <meta name="viewport" content="width=device-width, initial-scale=1.0" />     <title>Cool Clothes</title>     <!-- Global site tag (gtag.js) -->     <script       async       src="https://www.googletagmanager.com/gtag/js?id=AW-XXX"     ></script>     <script>window.dataLayer = window.dataLayer || [];       function gtag() {         dataLayer.push(arguments);       }       gtag("js", new Date());       gtag("config", "AW-XXX");</script>     <!-- Event snippet for conversion page -->     <script>gtag("event", "conversion", {         send_to: "AW-XXX/XXX",       });</script>   </head>   <body>     Thanks for Sign Up!   </body> </html> 

Here comes my question, the user goes through multiple different HTML pages, how did Google Ads know how to count the conversion?

Are Google Ads using first-party cookies to do this?

Please see this minimum example

I have a static HTML page that looks like this

<!DOCTYPE html> <html>   <head>     <meta charset="UTF-8" />     <meta name="viewport" content="width=device-width, initial-scale=1.0" />     <meta http-equiv="X-UA-Compatible" content="ie=edge" />     <title>New User</title>   </head>   <body>     <!-- Google Analytics Code -->     <script>(function (i, s, o, g, r, a, m) {         i["GoogleAnalyticsObject"] = r;         (i[r] =           i[r] ||           function () {             (i[r].q = i[r].q || []).push(arguments);           }),           (i[r].l = 1 * new Date());         (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);         a.async = 1;         a.src = g;         m.parentNode.insertBefore(a, m);       })(         window,         document,         "script",         "https://www.google-analytics.com/analytics.js",         "ga"       );       ga("create", "MY_UA", "auto");       ga("send", "pageview");       ga("send", {         hitType: "event",         eventCategory: "livechatNewUser",         eventAction: "redirect",       });</script>     <!-- Global site tag (gtag.js) -->     <script src="https://www.googletagmanager.com/gtag/js?id=MY_AdWords"></script>     <script>window.dataLayer = window.dataLayer || [];       function gtag() {         dataLayer.push(arguments);       }       gtag("js", new Date());       gtag("config", "MY_AdWords");       gtag("event", "conversion", {         send_to: "MY_AdWords/MY_Label",       });</script>     <script language="javascript">setTimeout(function () {         document.location.href = "/dashboard";       }, 1000);</script>   </body> </html> 

After 3 days, my ga backend is receiving some data

However, my ad words backend is not receiving any data

The date range is the same, Why is this happening?

I have added the gtag like following

<!-- Global site tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-189297876-1"></script> <script>   window.dataLayer = window.dataLayer || [];   function gtag(){dataLayer.push(arguments);}   gtag('js', new Date());   gtag('config', 'UA-xxxxxxxxx-x');   gtag('config', 'G-xxxxxxxxxx');   gtag('config', 'AW-xxxxxxxxx'); </script> 

Here I use the Google Analytics, the AdWords Conversion and the Global-ID.

When I check it with the Google Tag Assistant Plugin of Chrome, I get

I don't know, if this is a problem (the Message "Multiple installations of Global site tag (gtag.js) detected"). Is it only there one time.

Unfortunately, built in GTM tag "Google Ads Conversion Tracking" doesn't support setting special Hotel properties (used in Google Hotel Ads):

'items': [{   'id': 'PARTNER_HOTEL_ID',   'start_date': 'CHECK_IN_DATE',   'end_date': 'CHECK_OUT_DATE' }] 

Official docs are here: https://support.google.com/google-ads/answer/9244174?hl=en Instructions are for gtag.js and GTM is only mentioned in an unclear way (at least for me):

If you're using Google Tag Manager, you can implement the gtag.js for Hotel Ads by using the custom HTML tagging option to add the booked hotel variables. The global site snippet should be set to run on all pages, including the confirmation pages, and the event snippet should run on the confirmation pages only. We do not recommend using the Google Ads template because it does not support all variables for hotel campaign reporting.

If I understood correctly, I should install gtag using GTM and then the tracking using gtag? It sounds weird...