With Google Tag Manager you avoid that a whole series of scripts is added to the basic code of your website just to analyse the functioning of your site. This slacks down the site and instead it would work better, it works worse. With Google Tag Manager you add only some lines of base code and in your Google Tag Manager account you can add as many tags as there are. Your site won’t experience any payload in addition to the basic GTM code.
Photo 226545562 / Google Tag Manager © Seemanta Dutta | Dreamstime.com
After logging in to GTM, or registering if it is the very first time you use it, add the website you want to get information about.
Under ACCOUNT > [website GTM account name] > ACCOUNT SETTINGS > INSTALL GOOGLE TAG MANAGER you find the code for your website:
Put this code as high as possible in the head-tag.
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
!<-- End Google Tag Manager -->
Put this code immediately after the body-oping-tag.
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
It would be the same as without GTM the installation of the GA4 code immediately from Google Analytics. In analytics.google.com/analytics/web go to the Admin at the bottom and make a new property, this one for your website you want to track. Then press “Next”, answer the questions on the next page, and click “Create”.
A data stream is a data source from which events will be sent to your Google Analytics 4 property. There are multiple possibilities for data sources in a single property. You can data streams for different platforms. E.g Android, IOS and the WEB. Let’s focus here on the Web.
Enter the uURL of your website.
Choose for enable/disable enhanced measurement.
Then you see as STREAM DETAILS:
– NAME OF THE STREAM
– STREAM URL
– MEASUREMENT ID something like G-XXXXXXXXXX. Copy this ID and keep it for in Google Tag Manager.
– Go to GTM Container > Tags > New
– Choose GA4 configuration
In the Measurement ID field, enter the ID that you copied in the GA4 interface (in Google Analytics).
– Keep “Send a pageview event when this configuration is loaded” checked. In some cases also this can be unchecked so that you have only your measurement ID left.
Select “All Pages”
– Enter the the tag name, e.g. GA4 Configuration – [measurement-id]
With the standard tracking with GA4 is finished.
Creating a Configuration tag. It is the equivalent of adding that gtag tracking code (which is provided in the Admin section of GA property) to the website’s source code. Now we can test.
Before starting the real work, tracking visitors of our site, we do a control to see if everything is working correctly. For that purpose we use “GTM Preview”.
Other posts by admin