Everyone who has a website and gets traffic from Google Search or other sources has felt the need to use analytics. Google Analytics is the most popular analytics application not just because it’s free but also as Google is the most widely used search engine. You can also set up your Google Analytics through Google Tag Manager on WordPress.
Google Analytics can help you track the traffic on your website and understand your visitor’s behavior. The way it does this is by running a script on your website that tracks various actions taken by users, also called events, right from landing on your website to completing a conversion or exiting your website. The simplest way to add the analytics code on your website would be to just paste it in the head and body section of the HTML.
Now that would be fine if you just needed to use one script on your website. But what happens if your need to add the Facebook Pixel or you want to track heatmaps through Hotjar? You would constantly need to add codes on your website and messing with your source code could break your website. To avoid such damage and make it easier for smaller online businesses who can’t afford constant maintenance from a dev team, I suggest you use Google Tag Manager.
Introducing Google Tag Manager (GTM)
Google Tag Manager (GTM) can implement multiple scripts or codes which it calls Tags and all you have to do is install the Tag Manager tracking script on your website.
Follow these steps to install the Tag Manager on your website.
Total Time: 30 minutes
Follow this step by step guide to set up your website on Google Analytics.
Quick set up of your website’s account on the tag manager to get the tracking code.
No coding expertise required to set up the tag manager code on WordPress.
- Google Analytics, Google Tag Manager
1. Get Google Analytics Tracking Id
After creating your Google Analytics account through your Google email and creating an account for your website, you will get your Tracking Id. Follow this step by step tutorial to get your Google Analytics (GA) Tracking Id.
2. Create Google Tag Manager Account
- Visit tagmanager.google.com and sign in with your Gmail account.
- Select “Create Account”, fill the required information, and accept the T&C.
- On the dashboard, on the top bar, you will find your GTM tracking codes. You will need to paste both these codes in the head and body of the HTML of all your webpages.
3. Set up GTM Code on WordPress
- In another tab, login to your WordPress admin and go to your WordPress Dashboard.
- On the left panel, under “Appearance” select “Theme Editor”.
- In the Theme Editor, select your current theme then under Theme Files select “header.php”.
- From the Google Tag Manager, paste the codes in the head and body section accordingly.
Note – Be careful while editing your theme files as it can break your website. Always create a child theme and make a backup of your theme files.
Alternatively, you can use a plugin that will allow you to add the GTM code to your WordPress without editing your theme files manually. You can use a plugin like this – Insert Headers and Footers.
Finally, you can use the Tag Assistant extension in the Chrome browser to verify if your Google Tag Manager codes have been set up successfully on your website. Get the Tag Assistant extension.
If you found this article useful or have any other queries or suggestions, feel free to leave a comment or get in touch.