Goal: To add Google Tag Manager to a WordPress site.
Ideal Outcome: Google Tag Manager is properly installed without any technical issues.
Prerequisites or requirements: This exact process only applies to WordPress.org sites.
Why this is important: Google Tag Manager is a great tool to add and manage multiple pixels and tracking codes without the needing to edit the code of a site.
Where this is done: In your WordPress install and Google Tag Manager. When this is done: Only once—the first time you install Google Tag Manager. Who does this: The person responsible for website management or analytics.
Environment Setup
Important: This Article works only for selfhosted WordPress sites, aka WordPress.org
and not WordPress.com
-
Download the Google Tag Assistant Chrome Extension (Free)
-
Sign up for Google Tag Manager (Free):
-
You’ll need to log in to your Google account.
- If this is your first time creating a Google Tag Manager Account, you’ll be prompted to set up one right away.
- You can just use your company/website name for both the account and container
- Under “Where to Use Container”, select “Web”
-

c. Accept the terms and conditions.
- You will see your Google Tag Manager code, but you won’t need it using this method.
-
Once, you are in your Workspace, make note of your Google Tag Manager ID.

-
Click on Submit > Publish > Continue to publish your Google Tag Manager container.

Install and configure the Google Tag Manager WordPress plugin
-
Log in to your WordPress site.
-
In the WordPress sidebar, go to Plugins > Add New
-
Enter “Google Tag Manager for WordPress” in the search box
-
Install DuracellTomi’s Google Tag Manager for WordPress (the image may vary).

5. Activate the plugin.

8. Select the “Custom (needs tweak in your template)” container code placement and click on “Save Changes.”

9. Copy the PHP code provided by the plugin and click on “Save Changes”

10. In the WordPress sidebar, go to Appearance > Editor

13. This template is different depending on the theme that you have installed. However, you will always be able to find an opening <body> tag in the code.

14. Enter the PHP code provided by the plugin right below the opening <body> tag.

15. Click on “Update File”
QA-ing your installation
1. Open your website homepage using Chrome.
2. Click on the Google Tag Assistant Chrome Extension
3. Click on “Enable”
4. Refresh the page and click on the Google Tag Assistant Chrome Extension again.
5. You should see a green tag for Google Tag Manager, indicating that the installation was successful.