th
Goal: Google Tag Manager integration with a WordPress website.
Ideal Outcome: When Google Tag Manager is set up correctly and without any problems.
Prerequisites or requirements: Only WordPress.org sites can use this specific procedure.
Why it is significant: Without having to change the website’s source code, Google Tag Manager is a fantastic tool for adding and managing various pixels and tracking codes.
Where this is done: In Google Tag Manager and your WordPress installation.
When to do this: Just once, when you initially install Google Tag Manager.
Who does this: The person in charge of analytics or website administration.
Environment Setup for google tag manager integration
Important: This blog only applies to WordPress sites that are self-hosted, also known as WordPress.org, and not WordPress.com.
- Download the Chrome Extension for Google Tag Assistant Legacy (Free).
- Join Google Tag Manager integration for free:
a. To continue, you must sign into your Google account.
b. AlYou should create account page if you are creating a Google Tag Manager account for the first time.
- Please enter the following details:
a. Account name: The name you give this account to identify it.
b. Country — Origin country.
c. Name of the container — Enter the website’s address
d. Target platform: Where (such as on your website, on a mobile device, etc.) are you going to add Google Tag Manager?
e. (Optional) Send Google data in an anonymous manner.
- once completed. Click “Create.”
- A Google Tag Manager integration Terms of Service window will appear. Check the box, then select “Yes”.
- It will show you the installation code for Google Tag Manager . Since you will not be manually adding code to your WordPress site, disregard this. Select “OK.”
- Make a note of your Google Tag Manager ID once you are in your workspace.
a. Simply select “Submit > Publish” Publish your Google Tag Manager container as usual.
Install and set up the Google Tag Manager plugin for WordPress
- Access your WordPress website.
- Navigate to Plugins > Add New in the sidebar of WordPress.
- In the search bar, type “Google Tag Manager for WordPress.”
- Install the plugin GTM4WP (the image may vary)
- Turn on the plugin.
- Go to Settings > Google Tag Manager in the WordPress sidebar.
- In the available area, paste your Google Tag Manager ID (which you can find on the Google Tag Manager dashboard).
- To install the container code on your website, the plugin provides a number of options. We advise making a backup of your website before implementing any of them.
Option 1: Off — with this selection, the plugin will try to determine where the container should be placed for you. Although it is the simplest choice, there is a chance it might break something on your site’s front end. If codeless injection is the route you want to take, select it from the list and click “Save changes.”
After choosing this, open the website in a new tab or window to confirm that everything appears to be in order. If so, you can proceed to the installation’s quality assurance testing.
Option 2: Manually Coded – to use this choice, you will have to make a minor change to your theme files. You can use this option if your WordPress theme lets you make modifications and you are confident with the theme editor. Click “Save Changes” after selecting the “Custom (requires adjustment in your template)” container code placement.
- After copying the plugin’s php code, click “Save Changes.”
- Go to Appearance > Theme Editor in the WordPress sidebar.
- Make sure you are editing the theme that is presently installed on your website (you can check the name of the theme you are using by going to Appearance > Themes).
- From the list on the right, pick the template labeled “Theme Header.”
- Depending on the theme that you have installed, this template may be different. The opening body> tag may always be found in the code, though.
- Just below the opening body> tag, paste the php code that the plugin has provided.
- Select “Update File.”
Check the installation
- Use Chrome to view the homepage of your website.
- The Google Tag Assistant Chrome Extension should be selected.
- Select “Enable”
- Click the Google Tag Assistant Chrome Extension once more after refreshing the page.
- A green tag for Google Tag Manager should appear, signifying that the installation was successful.