Have an active account of Google Analytics. To get one login with your Google account here: analytics.google.com
What is Google Tag Manager?
Google Tag Manager(GTM) is a tool that helps analysts and marketers to analyze important data of their websites without the need of changing code on the website. The GTM just needs an initial setup including a snippet of code in all the pages of the website in order to track the data of the site. All the data gathered by GTM is displayed in the Google Analytics Dashboard. More about Google Tag Manager here.
- Go to https://tagmanager.google.com/#/home
- Create an account for your new project.
- Input the name of the account and the name of the website (Container name), select the Web option.
- Click the create button and then accept the Terms of Service Agreement.
- After accepting the Terms GTM will provide the installation script. Copy that script and paste it onto every page of your website. Place it immediately after the opening <body> tag. It should look like this:
Note: You can see you GTM script at all times by clicking on the container ID below the Google Tag Manager logo:
- In order to connect the tags created in GTM with the data of Google Analytics is necessary to link both sites, to do that go to analytics.google.com and then in the "Admin" tab go to "Tracking Code" under the "Tracking Info" section.
- Copy your Tracking ID and then go to Google Tag Manager, and under the section of "Variables" create a new variable.
- Create a constant called UA Number. Constants are used to make easier the use of GTM by saving values that are used several times. To create the constant UA Number fill the form with the value of the Tracking ID, and then click Save.
- The first tag we need to create is the "Google Analytics Pageviews" in order to track information in all the pages of the site. To create a new tag click on the "Tags" section on the side bar, then click the New button.
- To create the "Google Analytics Pageviews" fill the form using the UA Number. The tag should look like the following images:
- Every time you make changes on your GTM is necessary to publish the changes in order to see them in your site.
- To check if everything works, go to the Google Analytics Dashboard and under the "Real-Time" section click on "Overview", if you have open your site you should see one active user