How to Add Google Tag Manager to WordPress for Tracking Analytics
Do you want to track your WordPress website’s conversions, analytics, marketing, and other metrics? Learn how to set up Google Tag Manager (GTM) for WordPress with GTM4WP.
Good to know: are you more interested in tracking your social media analytics? We have a list of useful tools for that.
How to Add Google Tag Manager to WordPress
Before you can install Google Tag Manager (GTM) to your WordPress website, you need to create an account on the GTM page.
Follow these steps:
- Go to the Google Tag Manager page.
- Click on “Create Account.”
- Fill out the fields under “Account Name” and “Country” in the Add a New Account screen.
- Type your website URL in this format: “www.mywebsite.com,” on the Container Setup page under “Container name,” then check your target platforms.
- Click “Create.”
- Read the Google Tag Manager Terms of Service Agreement, and click “Yes” to finish creating your account.
- You’ll land on the Workspace page with a pop-up window that has sets of code hovering over the page.
FYI: check out the best wordPress plugins to integrate Bitcoins to your site.
Install the GTM4WP WordPress Plugin
Now that you have a GTM account, it’s time to set up a free WordPress plugin: GTM4WP. It will place the GTM container code to your WordPress website for you. Take these steps to install the plugin:
- Log in to WordPress. The account you’ll log in with should have the administrator role.
- From the menu on the left, hover over “Plugins,” then click on “Add New.”
- On the Add Plugins screen, search for “GTM4WP.”
- Click on “Install Now” beside GTM4WP.
- Click “Activate” to be taken to the Plugins screen.
Tip: communicate with your website visitors by adding a WhatsApp chatbox to your WordPress site.
Copy Tracking Code From Google Tag Manager
After installing and activating the GTM4WP WordPress plugin, copy the code from the GTM page by following this step-by-step:
- On the Google Tag Manager account page, click on the container ID or Google Tag Manager ID.
- On the Install Google Tag Manager pop-up window, there are two sets of container code that you need to set up GTM4WP in WordPress.
- Save the container codes and Google Tag Manager ID. You can also leave this Google Tag Manager tab open before going back to WordPress.
Paste Tracking Code in WordPress
Paste the container codes from Google Tag Manager by following these steps:
- In the menu on the left of WordPress, hover over “Plugins,” then click “Installed Plugins.”
- From your list of installed plugins, find “GTM4WP,” then click on “Settings” underneath it.
- Under the General tab on the Google Tag Manager for WordPress options screen, paste your container ID or Google Tag Manager ID, formatted as “GTM-XXXXXX,” to the Google Tag Manager ID field.
- Set “Container code ON/OFF to “On.”
- Select a Container code compatibility mode option.
- Off: allows GTM4WP to decide where the second GTM container code is placed. Select this if you’ll verify your website in Google Search Console.
- Footer: select this if you want GTM4WP to place the second code on the footer of your web pages. Note that this prevents Google Search Console verification from working.
- Manually coded: if you want to manually paste and tweak the container codes yourself, select this option.
- Click “Save Changes.”
WordPress alternatives: Thinking of trying other content management systems? Check out the best WordPress alternatives.
Frequently Asked Questions
Are there other WordPress plugins for Google Tag Manager?
Aside from GTM4WP, you can also use these free WordPress plugins for Google Tag Manager:
How do I know if my GTM is working?
Click “Preview” next to your container ID/Google Tag Manager ID in the Google Tag Manager account page. This will open a new tab for Google’s Tag Assistant. Enter your website’s URL, like the sample URL format, then click “Connect.” If the Tag Assistant says connected, you’re all set.
Do I need Google Analytics if I use Google Tag Manager?
No. You also don’t need Google Tag Manager to use Google Analytics. However, you can set up Google Analytics and Google Tag Manager and use them both. If you decide to use Google Analytics, check out these Google Analytics apps for Android.
Image credit: Pixabay All screenshots by Natalie dela Vega.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
اكتشاف المزيد من إشراق التقنية
اشترك للحصول على أحدث التدوينات المرسلة إلى بريدك الإلكتروني.