The GTM alone does nothing, you need to configure it. If you don't configure sending of pageview to Analytics obviously doesn't send it to Analytics.
There is a specific tag in GTM to send hits to Google Analytics and you can also send the userId through it. The GTM allows not to have codes on the page so all tracking is centralized, easier to manage and it is no longer necessary to modify the page code.
Answer from Michele Pisani on Stack OverflowVideos
Does Google Tag Manager replace Google Analytics?
Is Google Analytics part of Tag Manager?
What's the difference between GTM and GTAG?
My client has been tearing his hair out for 2 months trying to move to GA4 and get tags working. He wants to monitor traffic on his ecommerce site, log when products are viewed, and when they are purchased so he can tie it up with his ad spend. It seems like this is the meat and potatoes of what GA4 should do, he's not wanting anything exotic, so I said I'd try to help because I assumed he's doing something wrong. I should add that we use Google Mail and have done for probably 15 years or so, and as a developer I work with Android and rich snippets and various other Google code. So I am not an IT newb.
The client added me as a user to his account. When I go to my Google Analytics panel, I can see his site in there now. Can click on it and view details.
It gives me some code to put on the web site, and when I check, this is exactly what we have there already. So that much appears good. Also, I can see how many users in the last half hour, etc. so data is coming in.
Now I note that the code it gives me to put on the site links to the domain googletagmanager.com. So this GA4 code seems to basically be Google Tag Manager, or at least very closely related.
So I am thinking now I need to look at tags, maybe create some. But there is nowhere to do this in the GA4 panel. After some flailing around ( everything seems to be several clicks away from where it feels like it should be) I am informed that I need to go to Google Tag Manager. I follow the link, and duly log in. This feels a bit strange. I am not sure why I am logging into *another* Google system. It feels like this should all be in the same place, since GA4 code to place on your web site literally links to googletagmanager.com. Anyhow, I go with it.
But in Google Tag Manager, I see his domain, but it looks like an old ID. It starts GTM- instead of G- and the rest is completely different. I cannot see his new GA4 ID in there, the one that their Analytics panel shows and whose ID is baked into the code to put on the web site and which was shared with my account.
At this point I really have no idea how to create tags for an ID that doesn't appear in my Google Tag Manager panel, but has been shared with me via Google Analytics.
This all feels very half-baked. I've gone through the documents, but it all sends me round in circles, following links back to Google Tag Manager where the ID I need to work with is not present.
Does the client have to separately give me access to their web site ID in Google Tag Manager, even though they already shared it in Google Analytics? Is there a reason why Google decided that Analytics and Google Tag Manager should be separate entities, rather than a single integrated system, which would seem to make more sense?
yes could have the more that one GA tracking code on the page of the domain. Example for 2 GA code on the same page:
<scirpt> (function(i,s,o,g,r,a,m)......)
ga('create', 'UA-XXXXX-Y', 'auto');
ga('create', 'UA-XXXXX-Z', 'auto', 'clientTracker');
ga('send', 'pageview');
ga('clientTracker.send', 'pageview');
</script>
more: https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_with_multiple_trackers
- yes, the letters/names are up to you... you can prefix accounts with whatever you wish. They are there simply for individual addressing.
- yes, though keep in mind that order in which they load can not be guaranteed. You don't need to reload the actual ga.js for each one, a single instance is fine.
- yes, that's not an issue.
As a side note, if you are collecting data for more from more than one hostname into a single web property, you will need to set the domainname in your GA object.
I'm setting up GA4 on a website and I haven't done this in a while. When I last did this, there were separate tags you could create in a container specific to GA4. Now, they have the sort of catch-all Google tag. When you are in Tag Manager creating a new tag, you get a list of tag options to choose from. In the main list, there is a Google Analytics subsection, but there is also just a "Google Tag" option below it in the main list. However, when you go into the Google Analytics subsection, it has what appears to be the same "Google Tag" (and the GA4 Events tag). My understanding is the the Google Tag itself collects most of the basic events for analytics, but my question is this: Assuming that I don't need to set up any special events, do I need to create a tag using the "Google Tag" under the Google Analytics section AND create a tag using the "Google Tag" option on the main list? Or is that just the same thing?
Hopefully I explained that well enough. I was following this guide and it just shows you how to set up the Google tag with Tag Manager. As you can see, he selects the Google tag present in the main list. So I'm just wondering if I need to do anything more than that to get basic analytics because it seems as though there is no difference between that tag and the one in the "Google Analytics" section (excluding the events tag).
you can leave the global site tag tracking code snippet on your site, just do not also configure tags for GA pageview tracking within GTM.
If it were me, I would remove the global site tag tracking code snippet and configure tags for GA tracking within the google tag manager container.
Bit of extra information:
Both Tag Manager and gtag.js perform similar functions:
Tag Manager is a tag management system that allows you to quickly and easily update tags on your website or mobile app from a web interface.
gtag.js is the JavaScript framework that is used to add Google tags directly to web pages.
https://support.google.com/tagmanager/answer/7582054?hl=en
You need to add your Google Tag Manager code in your website.
Then, you have two options:
Leave it, don't do anything else. Your Google Analytics code will remain as it is and FB Pixel will be added via Google Tag Manager.
Alternatively, you can remove the code for Google Analytics from your website and add a tag in Google Tag Manager https://support.google.com/tagmanager/answer/6107124?hl=en (Recommended option for efficiency)
Do not mistake Google Tag Manager with the Global site tag you used to add Google Analytics, they are different things: https://developers.google.com/gtagjs
Google Analytics' main job is really just generating the reports and statistics about your website, like how many people saw your website yesterday, what web browser they used, which pages were the most popular, etc. The only way it can know this stuff is if you put a "tag" on all of your pages. The tag is the javascript code on your pages that runs on the visitor's browser, which tells Google Analytics' servers that they are visiting the page right now.
There's no problem if you just want to put the tag in the master file of your website so it shows up on all of your pages. Google Analytics can use the "referrer" parameter to figure out which page the visitor is on and can do all the simple stuff like counting page views.
However, you may want to track how many people use a specific feature. Maybe you want to group certain pages together or count some similar but different URLs as being the same page. Now you need unique tags for all these different features and groups of pages so Google can identify which feature or type of page got used or visited. Now it's complicated! You have multiple tags, and you only want the tags to "fire" sometimes (e.g. don't fire unless they click this button or use this feature.)
Google Tag Manager makes it easier to manage this mess of tags by letting you define rules for when your tags should fire. It also lets you test your tags to make sure they go off when you load the right page or click a certain button. This is done by putting the Tag Manager's code on your website instead of the actual tags, and as Crayon's answer points out, the tag manager outputs the tags for you. This gives you another cool benefit: you can change your tags and the way they work without actually changing the source code of your website (which you may not be able to do because of slow-release cycles) -- instead you just change it from the Google Tag Manager website, and it will spit out different code on your pages dynamically when they're loaded in the visitor's browser.
GA is the analytics tool that provides reports about activity on your site. GTM is a tag manager that can output tags based on defined rules. So for example, you can either implement your GA code on your site directly, or you can implement the GTM code and use GTM to output the GA code.
The main benefit of GTM (or any tag manager worth anything) is that you can use it for multiple tags or code snippets or pretty much anything you want. Usually you implement a data layer and a set of rules, and then within the tag manager interface, put a new tag or code snippet under those rules, using stuff from the data layer. That way for example, if you use GA today and then tomorrow want to also implement a different analytics tool e.g. Adobe Analytics, you can just do it within the GTM interface following the same rules and data layer you setup already.
So IOW GTM is a container in which to output other stuff. GA is one of the "other stuff" you'd output.
You can merge the two. Just add the config line of the Google Ads tag after the config line of the GA tag.
This is one of the benefits of the gtag system. You can track multiple accounts with the one tag.
For anyone still searching for this, here’s some additional guidance to expand on Tony McCreath’s answer. Google provides detailed documentation on adapting an existing Google tag for your Google Ads account. You can find it here: https://support.google.com/google-ads/answer/7548399?hl=en ("How to adapt an existing Google tag for your Google Ads account"). This should cover the exact steps you need.