Inserting Google Tag Manager code into the website is what a digital marketer must do sooner or later, now it’s your turn. It can be said that Google Tag Manager is number 1 in measuring website because it can be combined with all different tracking and advertising platforms. And in this article, I have summarized how to insert Google Tag Manager code into the most popular web platforms in Vietnam. Will definitely help you.
A quick introduction to Google Tag Manager
What is Google Tag Manager?
Think of Google Tag Manager as a container. It will contain all tracking code of different platforms such as Google Analytics, Google Ads, Facebook Pixel. And instead of you having to edit website source code to insert for each platform, now you just need to insert Google Tag Manager into your website. Then you can insert and edit other tracking codes right in the management interface of Google Tag Manager. Avoid touching website source code that can damage your website.
Does Google Tag Manager make a website heavy?
Not significantly, even when you use Google Tag Manager to contain other Google code such as Google Analytics and Google Ads, it is even more compact than inserting code directly into the website source code.
Is it okay if you insert tracking code into the website and then add it to Tag Manager?
Will be duplicated, the figures may be duplicated in your report. So any tracking code has already been inserted into the website source code, there is no need to insert it into Google Tag Manager anymore. You can remove all the tracking code in the website source code and then re-add it to Google Tag Manager for easy management.
How to create and get code Google Tag Manager
If you have never used Google Tag Manager, learn how to create a Tag Manager account and get its code.
Create a Google Tag Manager container
Step 1: Go to tagmanager.google.com and click Create account .
Step 2: You fill in full then click Yes .
- Account name: The name of your brand or website.
- Country: Vietnam.
- Container Name: The name of your brand or website.
- Targeting platform: Web.
Step 3: You tick I accept the Terms of data processing required by GDPR. Then click the Yes button above.
Step 4: After creating the Tag Manager container, click Submit for it to work.
Step 5: You don’t need to fill in anything, click Publish above.
Step 6: You don’t need to fill in anything, click the word Continue below.
Wait a few seconds Google Tag Manager will finish publishing. Then you click on the tab workspace (just below the logo Tag Manager) to take the code slightly.
Get the Google Tag Manager code
In the Google Tag Manager Workspace tab , you click on the ID code to get 2 snippets of code. To make the article easier to understand, I will name them as follows:
- Code A: Is the code inserted between the <head> and </head> of the website.
- Code B: Is the code inserted between the <body> and </body> of the website.
How to insert Google Tag Manager into LadiPage web
Insert Google Tag Manager into LadiPage by ID code: Go to Settings> Conversion Code. Then paste the ID code into the Google Tag Manager ID section. You see its example to understand.
- Before the </head> tag: You paste code A.
- Before the </body> tag: You paste code B.
After inserting the Tag Manager code, remember to click Publish LadiPage.
How to insert Google Tag Manager into Haravan web
In Vietnam, Haravan is also very popular, and here are 2 steps to insert Tag Manager into Haravan surprisingly easy.
Step 1: You login to Haravan’s admin page, then go to Website and Interface. In the interface you are using, you click the 3 dot button and select Edit code.
Step 2: You look in the Layouts folder, click on theme.liquid to edit. You insert code A first </head> and code B after <body> as shown below. After inserting, remember to click Save .
How to insert Google Tag Manager into WordPress website
One of the most popular open website platforms today is WordPress. And it only takes 2 steps to insert Tag Manager into WordPress only.
Step 1: To securely insert Google Tag Manager code for your WordPress website, install the Insert Headers and Footers plugin .
Step 2: Go to Settings and select Insert Headers and Footers. Then you insert the Tag Manager code as follows.
- Script in Header: You insert code A.
- Scripts in Body: You insert code B.
After inserting, remember to click Save . Note: If you use a cache plugin, delete the cache.
How to insert Google Tag Manager into website code manually
Often you are an affiliate or use static websites (HTML files). You find the right HTML file of the landing to edit and then insert the Google Tag Manager code according to this rule.
<head> Code A </head> <body> Code B </body>
How to check if Google Tag Manager is working
Insert the Tag Manager into the web, but how do we know if it works. In many cases, the agency asks the customer to tell the website service to insert it, but in the end, the agency says it has inserted the other side and has not.
Then how to check if Google Tag Manager has been inserted into the web and not inserted correctly I will show you.
Step 1: You install the Tag Assistant extension on the Chrome browser. Click the button below to open the widget page.
Step 2: Click the widget button and then click the pin button next to Tag Assistant to bring it up for ease of use.
Step 3: Open the website with Google Tag Manager inserted, then click Tag Assistant, then click Enable and reload the website.
How to know if tags in Tag Assistant are inserted correctly or not as follows.
- Blue and green: You inserted it correctly, the tracking code is working.
- Yellow and red: You inserted it wrong, need to check again.
Some common errors when inserting Tag Manager into the website
If you use it for the first time, you may encounter errors when inserting Tag Manager into the web . Here are some common errors and how to fix them.
- Inserted correctly, but why do you check that Tag Assistant is not working properly: There are 2 cases. 1, you have not clicked send as in the step of creating a Tag Manager container . 2, you insert the wrong position of code A and code B, please read carefully the article again and see if you inserted it correctly.
- Code found outside of <body> tag: Check that code B has been inserted correctly between <body> and </body>.
- Invalid or missing account ID: Check that your Google Tag Manager ID code is wrong.
- Tag is included in an iframe: Your Tag Manager tag must be placed directly on your website, not through an iframe.
The following errors are caused by inserting code B in the middle of an element tag in HTML that is not <body>. You must insert B code right after <body>. Please check the placement of B code.
- <script> tag must not be included in a <span>
- <script> tag must not be included in a <section>
- <script> tag must not be included in a <p>
- <script> tag must not be included in a <i>
- <script> tag must not be included in a <header>
- <script> tag must not be included in a <form>
- <script> tag must not be included in a <footer>
- <script> tag must not be included in a <dl>
- <script> tag must not be included in a <center>
- <script> tag must not be included in a <ns:robots>
- <script> tag must not be included in a <flow:ifenabled>
- <script> tag must not be included in a <div>
- <script> tag must not be included in a <div>
How to use Google Tag Manager for tracking
The content of this article I only focus on is to insert the Tag Manager into the web. As for the way to use tracking types, I will write to another post and will update the link here or you can see in the article section about Google Tag Manager .
Regardless of the website platform, the rules for inserting the Tag Manager code into the web are the same, code A is first </head>, and code B is after <body> . If there is any popular platform in Vietnam that you cannot insert, please comment below, I will support you and update the article.