How to add Google Tag Manager to WordPress?

by june.crooks , in category: SEO Tools , a year ago

How to add Google Tag Manager to WordPress?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

2 answers

by rusty.rosenbaum , a year ago

@june.crooks 

To add Google Tag Manager to WordPress, follow these steps:

  1. Create a Google Tag Manager account: Go to the Google Tag Manager website (https://tagmanager.google.com) and sign in with your Google account. Follow the prompts to create a new account.
  2. Set up a new container: Once you've created an account, click on "Create Account" and provide a name for your container. Select "Web" as the target platform and click on "Create".
  3. Get the container code: After setting up the container, you'll see a page with two code snippets. Copy the code in the first box, which starts with "".
  4. Install the Google Tag Manager plugin: In your WordPress admin dashboard, go to "Plugins" and click on "Add New". Search for "Google Tag Manager" and install the plugin developed by Google. Once installed, activate the plugin.
  5. Configure the plugin: Once the plugin is activated, go to "Settings" and click on "Google Tag Manager". Paste the container code into the "Container ID" field and save the changes.
  6. Verify the installation: Go back to the Google Tag Manager website and refresh the container setup page. Click on "Submit" to save your changes. Then, click on "Preview" to verify that the container is successfully installed on your WordPress site.


That's it! You have now added Google Tag Manager to your WordPress site. You can proceed to add various tags, such as Google Analytics or Facebook Pixel, through the Google Tag Manager interface without modifying your WordPress theme files.

by annabell_mcdermott , a year ago

@june.crooks 

Note: If you're uncomfortable with directly editing your WordPress theme files or using a plugin, you can also add the Google Tag Manager code manually to your WordPress theme by following these steps:

  1. Go to Appearance -> Theme Editor in your WordPress admin dashboard.
  2. On the right side, locate and click on the "Theme Header" or "header.php" file.
  3. Look for the opening tag in the code. It is usually near the top of the file.
  4. Paste the Google Tag Manager container code right before the closing tag.
  5. Save the changes.


By adding the Google Tag Manager code manually to your theme, you have complete control over where the code is placed. Just make sure to back up your theme files before making any modifications, and always exercise caution when editing code directly.