Switch to Tag Manager, will Enhanced Ecommerce still work? - google-tag-manager

I've successfully implemented Google Enhanced Ecommerce on one of my websites, where I also have a Google Universal Analytics tracking code. Now we want to change to Google Tag Manager, thus replacing the UA tracking code with the Tag Manager Code (correct?)
Will this affect the Enhanced Ecommerce tracking in any way? Or can I just replace the tracking snippet and the ga('create')-parts with the Tag Manager-snippet?

You need a correctly set up dataLayer (which rather more complicated since you need info on product impressions etc). Documentation is here:
https://developers.google.com/tag-manager/enhanced-ecommerce#enable
Then you create a news Analytics Tag (just a pageview or event, there is no need for a separate transaction tag) and select "Enhanced Ecommerce" with the "Use datalayer" option in the advanced settings.
GTM will pick up the values from there datalayer and do the rest for you.
So yes, you can get this to work, but it requires a lot of preparation for the correct datalayer implementation. Simply replacing the GA code with the GTM code will do very little except breaking your tracking.

Related

no data appears on GA Ecommerce report

I need your advice. My developer has implemented the enhanced e-commerce tracker to the website according to this guideline: https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce#measure_purchases
The screenshot below is the screenshot of the data layer that fired when people reached the order completed page.
I'm tracking the order completion via the GTM event tag below:
This event is fired as expected on the order completed page, however, I'm not seeing the transaction data under the GA > eCommerce section after 2 days.
Do I need to advise the developer to implement the tag according to this guideline instead? https://developers.google.com/tag-manager/enhanced-ecommerce#purchases
Is there anything I can do on my end without having the developer to amend the codes on their end?
I appreciate your advice.
Yes, if you're using GTM to pass enhanced ecommerce data you'll need it to be formatted as described in the GTM docs: https://developers.google.com/tag-manager/enhanced-ecommerce#purchases so the pushed object has ecommerce property and subsequently the purchase property.
Your current setup will work with gtag.js implementation but not with GTM Universal Analytics tag.

What is gtag and why do I have to add that separately from google tag manager?

I find Google documentation around Google Tag Manager (GTM) terrible at helping me figure out which bits go where.
As I understand, GTM requires that you put a <script> snippet on your pages which is supposed to bring in other code snippets, as could be configured by a non-technical user.
I'm a technical user, though. Perhaps that's the problem! I also find it problematic that Google use the word "tag" to refer to either an HTML element tag, like <script>, or their own proprietary use of the word to mean calling a function ("triggering a tag") in another script, also unhelpfully referred to as a tag.
They also have "gtag" which is what - a helper? something that enables you to send general analytics events through the GTM API? The docs simply say:
The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform.
... but we could already send analytics? What does this add?
For example, I wish to send an e-commerce Purchase event.
I've found that to do this I needed to add a new snippet of code with two <script> tags to the header on the site (thought GTM meant I didn't need to do this?) that sources gtag.js, then I'm able to call the following at the appropriate place in my javascript:
gtag('event', 'purchase', { value: 1.23, transaction_id: 'test' });
Or without it (although this does not seem to work):
ga('require', 'ec');
ga('ec:addProduct', {name: 'test product', price: 1.23})
ga('ec:setAction', 'purchase', { id: 'test_id_1', revenue: 1.23 })
So my question is: when would you use gtag() over ga(), and why can't GTM install gtag?
When would you use gtag() over ga()?
Use gtag if you want to send data to supported Google products other than Google Analytics. As you pointed out, "The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform.", whereas ga only works for Google Analytics. But (see below), you might decide to never use gtag nor ga and always use GTM.
Why can't GTM install gtag?
It could (you could have a GTM tag inserting some gtag code) but it's beside the point as they are meant to be used as 2 different solutions:
gtag is a purely programmatic tracking tool for sending data and only works with 3 Google products (so far - Analytics, Ads, Marketing Platform - more maybe added in the future), it's made to provide basic out-of-the-box tracking with a simple copy/paste + small lines of code (if needed for customization).
GTM is a tag manager: it can work programmatically BUT requires a minimal configuration of the container via the GTM UI (a default container won't send data anywhere), and can send data to whatever products you want (just need to setup the corresponding tags in GTM), while having a bunch of other features
A few questions to help you choose:
Am I sending data to other tools than Google Analytics/Ads/Marketing platform?
Do I want to use some the extra features GTM offers (UI, version control, templates, debug, environments etc...)?
Is there some tracking that would be heavy to implement via pure custom JS (eg scroll tracking) which GTM can facilitate with its built-in listeners (eg scroll tracking)?
If YES to any of the above, then use GTM
I personally never use gtag, I always replace it with GTM because it's considerably more powerful than gtag.
What Google is doing is progressively replacing all their default snippets with gtag so they only have 1 unified API to maintain and it's an easy copy/paste for users (bear in mind most users aren't tech savy and just need to paste the snippets in into their CMS). Forcing people to use GTM would be too much of a friction as out-of-the-box GTM simply doesn't track anything and people would need to learn & configure GTM, too much work vs a simple copy/paste.
Note: The built-in events don't use category, label, and value. Take care to use the correct keys when sending these events.

GTM and Enhanced Ecommerce. Not showing in Analytics - Scraping DOM for DataLayer

I'm having a nightmare trying to get enhanced eCommerce data showing in Google Analytics. Using Tag manager I've got the below in my data layer but I can't see anything in my Google Analytics account.
Unfortunately at the moment I'm having to scrape the DOM for the relevant information, so I'm pushing all the information to the datalayer with a 'payment ' event. The corresponding tag is correctly firing on this event.
The GTM preview inspector is showing everything as I would expect
I have ticked the relevant enabled enhanced eCommerce boxes and waited 72 hours after each attempted change but still no luck - can anyone help? I'm sure I've missed a simple step somewhere but no luck on the Google developer docs.
Many Thanks,
Eoghain
'Payment' Event:
After page Fully Loaded:
Tag:
Trigger:
OK I believe the issue is because you are using the Transaction type tag. This applies only to standard e-commerce. You need to piggyback your e-commerce data with either a pageview or a (non interactive) event.

Should I remove GA/GDN code if I'm using GTM?

Does GTM code + GA/GDN Tag is enough to track my website analytics ? should I remove GA code if I'm using GTM ?
And aboud google adwords goals , should I remove Google adwords code too and use that one provided from GTM ?
Does GTM code + GA/GDN Tag is enough to track my website analytics ?
Yes, if you have configured the GA tracking tag in the tag manager you do not any other GA code on your site.
should I remove GA code if I'm using GTM
Yes. You do not need it anymore and if you do not remove it you might track your pages and event twice.
And aboud google adwords goals , should I remove Google adwords code
too and use that one provided from GTM
While it is still possible to use the Adwords code side by side with the tag manager it does not make any sense. As a matter of elegance and maintainability I'd say YES, you should remove page code and use GTM instead. Having all tags in one location is after all the point of GTM.

Google Analytic not required

I have created a new website and trying to add Google Analytic stumbled upon Google Tag Manager. Looks like based on what I am seeing there I don't need to create Google Analytic account at all. Am I right or I am missing something?
GTM is just a tag manager. A tag manager outputs tags based on rules and data layers and stuff. GTM has tight integration w/ GA (as opposed to just outputting the code in a generic container) since it's a google product. But GTM is separate from GA. You still need to create a GA account and specify that acct # in GTM. All GTM does is output the GA code. GTM does not collect the data or provide reports. That's what GA is for.

Resources