Google Tag Manager for Beginners

Guide Overview:

This Google Tag Manager (GTM) guide will help you quickly and easily update the measurement “tags” on your website or mobile app. Once the small code snippet has been added to your project, you can safely and easily deploy analytics and measurement tag configurations from a web-based user interface. GTM should be used when you need to track multiple entities such as Google Analytics and Facebook Pixel.

For this guide, we assume that you already have Google Analytics set up. If that’s not the case, please see our Google Analytics for Beginners guide.

Google Tag Manager Account Setup
Add Google Analytics Tag to Google Tag Manager
Add Google Tag Manager to WordPress Without Plugins
Add Google Tag Manager to WordPress With Plugins
Verify Google Analytics Tracking

Add Facebook Pixel Tag to Google Tag Manager
Verify Facebook Pixel Tracking

Google Tag Manager Account Setup

  1. Visit the Google Tag Manager website.
  2. Click the Create Account link.
  3. Enter an Account Name.
  4. Choose your Country.
  5. Enter the URL (without the https://) of your website for the Container Name.
  6. For the Where to use container setting, choose Web.
  7. Click Create.
  8. Check the I also accept box and click Yes to accept the terms.
  9. Close the Install Google Tag Manager dialog box.
  10. Click the Submit button in the upper right of your screen.
  11. Click the Publish button in the top right of the screen.
  12. Click Skip.

Add Google Analytics Tag to Google Tag Manager

  1. Log into your Google Analytics account.
  2. Go to Admin > Tracking Info.
  3. Click Tracking Code.
  4. Copy your Tracking ID (UA-xxxxx…).
  5. Go back to Google Tag Manager and click the Workspace tab.
  6. Click Add a new tag.
  7. Click on the Tag Configuration box.
  8. Select Google Analytics – Universal Analytics.
  9. Check the Enable overriding settings in this tag box.
  10. Paste your copied Tracking ID into the Tracking ID box.
  11. Click the Triggering box.
  12. Click All Pages.
  13. Click Save.
  14. Accept the default tag name or set a custom one if desired.

Add Google Tag Manager to WordPress Without Plugins

We highly recommend that you use a child theme, if you’re not already, so the changes we make here are not lost when you update your parent theme.

Our preference is to do the job without adding additional plugins to the mix. While there are plugins available for these steps, we found that there is the same amount of work/complexity involved when using those plugins.

  1. Connect to your website via FTP, using an FTP client such as FileZilla. (Note: As a general rule, you should always have access to your website via FTP, for troubleshooting purposes and general file management.).
  2. Browse to your parent theme (wp-content > themes).
  3. Download a copy of the header.php file from your parent theme to your local workstation.
  4. Edit the downloaded header.php file using your preferred text editor.
  5. Pull up Google Tag Manager and go to the Admin tab.
  6. Click Install Google Tag Manager.
  7. Using the easy instructions provided, copy/paste the code snippets into the header.php file, and save.
  8. Using your FTP client, browse to the child theme folder.
  9. Upload your edited header.php to the root of your child theme folder.

Add Google Tag Manager to WordPress With Plugins

For those more comfortable with using plugins, rather than editing theme files directly, this section is for you.

One benefit to not editing theme files directly is it reduces the chance of missing out on updates/changes to parent theme files, like header.php. 

Note: Please remember to only have GTM set up for tracking using only one method. For example, if you’re moving over to the plugin method, be sure to address any theme files you edited previously.

So, in our case, we no longer need to have a copy of header.php in our Child Theme, so we simply remove it.

Pro Tip: We recommend keeping a changelog of everything you do on your website, in terms of adding/editing/removing files, what solutions were added and why.

SEOPress

Both the Pro and non-Pro version of SEOPress includes the ability to easily add Google Tag Manager.

  1. Pull up Google Tag Manager and go to the Admin tab.
  2. Click Install Google Tag Manager.
  3. In another browser tab, navigate to WordPress Dashboard > SEO > Google Analytics.
  4. Google Analytics > Enable.
  5. [HEAD] > Paste in your code snippet that can be found from step 2.
  6. [BODY] > Paste in your code snippet that can be found from step 2.
  7. Save changes.

Verify Google Analytics Tracking

Before you begin, if you have already configured a filter in Google Analytics, to exclude your IP address, you can either temporarily remove/adjust that filter, do the steps below on a different network, or you can create a new Google Analytics view to hide your own traffic.  It’s easiest just to temporarily adjust your IP filter by changing the first number in the IP address and then changing it back after testing.

  1. Pull up Google Tag Manager and go to the Workspace tab.
  2. Click on the Preview button in the upper right corner of your screen.
  3. From the same exact browser, open up a new tab and browse the website you’re tracking.
  4. If tracking is working properly, you will see a Tag Manager info box on every page of your website (Note: You may need to hard refresh your browser to see the preview kick in.).

Once you verify that tracking is working properly, be sure to turn off Preview Mode, by returning back to Google Tag Manager and clicking Leave Preview Mode.

Note: If you believe you’ve followed all the steps and you’re still not seeing the preview kick in, it could be that you have an SEO plugin that’s filtering out tracking for particular WordPress roles. So, be sure to double-check those settings.

Add Facebook Pixel Tag to Google Tag Manager

  1. Go to your Pixels tab in Facebook Event Manager.
  2. Click the Get Started button in the Facebook Pixel: Track Website Activities section.
  3. Put in your website name for your Pixel Name.
  4. Put in your website URL.
  5. Click Create.
  6. For the Install Facebook Pixel dialog box, click Connect a Partner Platform.
  7. Choose Google Tag Manager.
  8. Click Continue.
  9. Enable Turn On Automatic Advanced Matching.
  10. Click Continue.
  11. Choose your Google account.
  12. Select your desired Google Tag Manager account and container.
  13. Close.
  14. Go back to Google Tag Manager.
  15. Click Triggers.
  16. Click New.
  17. Click the Trigger Configuration box.
  18. Choose Page View.
  19. Click Save.
  20. Click Save.
  21. Click the Submit button in the upper right of your screen.
  22. Click Publish.
  23. Click Skip.

Verify Facebook Pixel Tracking

  1. Go to Facebook Event Manager.
  2. Select your Data Source (should be the name of the Pixel you just created).
  3. Go to the Test Events section.
  4. Browse your website pages.
  5. Look back in the Test Events section and you should start to see Page View entries appear under Receiving Activity.

Let's empower others. Share the knowledge.

Share on twitter
Share on facebook
Share on linkedin
Scroll to Top