Categories
Procedures

Install Google Tag Manager in WordPress

A step-by-step procedure to install a Google Tag Manager container on a WordPress website.

Requirements

This procedure will work only if:

  • The Google Tag Manager container exists.
  • The website runs on WordPress.
  • You have admin rights to both.

Note: This procedure will work also for WordPress websites running the AMP plugin.

Procedure

1.

Go to Google Tag Manager, navigate to the Workspace of the container in question.

2.

Click the container’s ID number in the top navigation bar. A window with the installation code will pop up.

Location of the container ID in the top navigation bar.
3.

Select the <head> portion of the code and copy it to your clipboard (click the Copy icon on the right or press Ctrl+C).

Location of the <head> portion of the code.
4.

Open a new browser tab (Ctrl+T) and login to the WordPress Dashboard of the website in question.

Note: This procedure uses the Insert Headers and Footers plugin to insert the container code. However, it is not the only way to do it and some themes and other plugins might offer a similar function.

5.

Navigate to Settings > Insert Headers and Footers.

6.

Paste the <head> portion of the code to the Scripts in Header field (Ctrl+V) and click Save.

Location where to paste the <head> portion of the code.
7.

Switch to the browser tab with Google Tag Manager. Select the <body> portion of the code and copy it to your clipboard (click the Copy icon on the right or press Ctrl+C).

Location of the <body> portion of the code.
8.

Switch back to the browser tab with WordPress. Paste the <body> portion of the code to the Scripts in Body field (Ctrl+V) and click Save.

Location where to paste the <body> portion of the code.
9.

Switch back to the browser tab with Google Tag Manager. Close the pop-up with the container code and click Preview.

Location of the Preview button.
10.

Open a new browser tab and load the website’s home page (refresh the window, if it’s already opened). The Google Tag Manager container is successfully installed, if you see the debug pane.

Location of the Debug pane

Note: Currently, the Debug pane doesn’t display on AMP websites. To check the container code is properly installed on an AMP website, view the page source and look for both portions of the container code.

11.

Switch to the browser tab with Google Tag Manager. Click Leave Preview Mode.

Location of the Leave Preview Mode link
12.

Click OK to confirm leaving the preview mode. The Google Tag Manager will load the Workspace, again.

13.

Close all open tabs.

References

Revision history

1.1.0

2020/03/07 – Tool change. Removed: GP Hooks. Added: Insert Headers and Footers.

1.0.0

2018/03/08 – First version released.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.