Google Tag Manager is a tag management system (TMS) that can be used to quickly and easily update measurement codes and related code fragments collectively known as tags on the website or mobile app. This is not a tracking system, to set up the data tracking please first Install Google Analytics 4.
To learn more please refer to the following Google document: Tag Manager overview
To also use Google Tag Manager, get started here: https://developers.google.com/tag-manager/quickstart
NOTE: This setup needs a GTM (Google Tag Manager) ID, which can be set up following these instructions: Set up and install Tag Manager
In Tag Manager, click on the body to create a container:
Name the container and select the Web option and click on Create:
This will display the codes that need to be added to the website:
As can be seen above, there are two sections of code provided.
1) The first part of the code goes in the HEAD section, to do this go to:
Settings > Design Settings > Custom CSS/HEAD > Additional HEAD Code:
The code would look like this (replace GTM-XXXXXX with the container ID):
<!-- 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-XXXXXX');</script>
<!-- End Google Tag Manager -->
2) Then to add the Tags use a widget called: Bootstrap Theme - Google Tag Manager Code widget. To edit this widget and add the code go to:
The Tag code has the following format (replace GTM-XXXXXX with the container ID:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
After placing the code, click on Submit in Tag Manager:
And click on Publish after it:
If after following the instructions in this article to set up Google Analytics, these are not working as expected, use this tool to see errors with the Google Tag Manager code added to a site, and the possible solutions: https://tagassistant.google.com/