Posts tagged with google-tag-manager

We have a problem with E-Commerce transactions sometimes not beeing set in relation to an ad click ("cpc"). They appear instead with the Channel/Medium "direct". This is a problem as we cannot correctly link our revenue to the costs spend on Google Ads.

We got a payment system that allows buyers to safely pay to sellers, and we get a fee percentage of the payment volume (similar like PayPal). We get our fees as soon as a pay-in is successful. Because our users can pay via bank wire as well it may take one or two days until we actually get our fee. This is why ecommerce transactions are not sent from the frontend to GA (on a thank-you page like in online shops), but from our server directly to GA as soon as a payment succeeds.

This is the GET call our server does when a payment succeeds:

GET https://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX-1&cid=1746XXXXX.1593XXXXXXX&t=transaction&ti=mytransactionID&tr=1&cu=USD

Here is a small diagram that explains the process:

We use cross-domain tracking, and the GA Client ID of the users stay the same when they get redirected from mydomain.com to app.mydomain.com, so this should not be the problem. What I assume is, that when a user clicks on an ad, the gclid of the ad is lost. Is there a way to manually send the gclid ID to Google Analytics? I would store the gclid then as well in our payment. Or is there another (maybe better way) to send transactions to GA?

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...

I have a nuxt App which makes use of the nuxt community module gtm-module: https://github.com/nuxt-community/gtm-module/ which takes care of google tag manager stuff.

I now have the case that I need to add Adwords into the mix. According to this source (https://support.google.com/google-ads/answer/7548399?hl=en#adapt_gtag) it should be easy to just add another config id – the AW-CONVERSION_ID – to my global site tag.

Unfortunately the gtm-module does neither describe how to handle Adwords nor how to add custom stuff to the site tag.

<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID">   </script> <script>window.dataLayer = window.dataLayer || [];   function gtag(){dataLayer.push(arguments);}   gtag('js', new Date());   gtag('config', 'GA_TRACKING_ID');   gtag('config','AW-CONVERSION_ID'); // THIS IS WHAT I NEED ADDITIONALLY</script> 

Does anyone know how I could accomplish the described solution here (https://support.google.com/google-ads/answer/7548399?hl=en#adapt_gtag) but with the nuxt gtm community module?

Help is very much appreciated.

Cheers

I'm trying to pull a GCLID Parameter (EXAMPLE: https://www.example.com?gclid=CjwKCAjwiMj2BRBFEiwAYfTbCjQ-LBlWhBymAH4piPD3FalPCbl24kE7VQ4JtNJ4Jfj8XPE) from a URL and insert it into a Squarespace hidden field.

Ideally, I'd like to do this through a GTM script, but I can also add it directly into Squarespace via site-wide footer code injection. All Squarespace hidden fields start with the prefix "SQF" (in my case, the hidden field is: SQF_GCLID

I've been playing with something like this:

`<script> window.Squarespace.onInitialize(Y, function() {   /**    * Get the URL parameters    * source: https://css-tricks.com/snippets/javascript/get-url-variables/    * @param  {String} url The URL    * @return {Object}     The URL parameters    */   var getParams = function (url) {     var params = {};     var parser = document.createElement('a');     parser.href = url;     var query = parser.search.substring(1);     var vars = query.split('&');     for (var i=0; i<vars.length; i++) {       var pair = vars[i].split('=');       params[pair[0]] = decodeURIComponent(pair[1]);     }     return params;   };   /**    * Get UTM parameters from the current URL, insert them into correspondingly-named Squarespace form hidden fields.    */   var params = getParams(window.location.href);   var param;   var paramMatch;   var paramBase;   var formFields;   var i;   for (param in params) {     paramMatch = param.match(/^gclid(.*)/i);     if (!paramMatch) {         continue;     }     paramBase = paramMatch[1];     formFields = document.getElementsByName("SQF_GCLID");     i = formFields.length;     while (i--) {       if (formFields[i]) {         formFields[i].value = params[param];        }     }   } }); </script>` 

which is based on the code found here.

There are no other parameters to pass (just gclid).

i want to create a dynamic remarketing campaign in Google Ads, but i have to let GTM know where to extract the information for ecomm_prodid, ecomm_pagetype, ecomm_totalvalue and ecomm_category from my website. I understand that i have to create a Data Layer Variable but i just don't know how to make those tags extract the necessary info from my website. I also know that you should be able to see in Google Tag Assistant the Metadata for your products (price, brand, category etc) in the Dynamic Remarketing Tag. Unfortunately i cannot add code to my website as it was created on a platform that doesn't allow custom code, so i have to use GTM.

For example the class for the price is: fPrice -g-product-final-price-258. Shouldn't ecomm_totalvalue take info from this class? I tried reading Help pages from google but they are soooo confusing, i cannot understand them.

If anyone would help me with this i would be very grateful.

Thanks