Google Tag Manager (GTM) is a free tool for installing, storing, and managing marketing tags that track user actions and collect data.
The most common example of a marketing tag is the Google tag used to install Google Analytics and other Google products. Other common examples include Google Analytics event codes, Google Ads conversion scripts, Meta Pixel code, and remarketing tags.
This guide will show you how to efficiently add and update your website tags better to understand conversions, site analytics, and more. It assumes you already have Google Analytics set up, as covered in the Google Analytics for MyListing guide.
Google Tag Manager Setup
- Visit the Google Tag Manager website.
- Click the ‘Create Account’ button.
- Enter an Account Name and choose your country.
- Container Name > Enter your website’s URL (without the https://).
- Target Platform > Web
- Click the ‘Create’ button.
- Accept the terms.
- Close the ‘Install Google Tag Manager’ dialog box.
- Click the ‘Submit’ button in the upper right of your screen.
- Click the ‘Publish’ button in the top right of the screen.
- Container Version Description > Click ‘Skip.’
- Close any remaining popups until you return to the main Google Tag Manager screen.
You should see a big green box that says something similar to “Version 123 is Live.”
Add Another Container (Website) to Your Account
This section is to be referenced only when you need to add more websites to your Google Tag Manager account.
- Google Tag Manager > Click on the ‘Admin’ tab.
- Click the ‘+’ icon from the right-hand column to add another Container.
- Container Name > Enter your website’s URL (without the https://).
- Target Platform > Web
- Click ‘Create.’
Add Google Analytics to Google Tag Manager
- Google Tag Manager > Click the ‘Workspace’ tab.
- Click ‘New Tag.’
- Click ‘Untitled Tag’ and give your tag a name. (e.g., My Business GA4)
- Click on the ‘Tag Configuration’ box.
- Select ‘Google Analytics G4 Configuration.’
- Measurement ID > Paste in your Google Analytics ID. (Note: The ID can be found by going into your G4 property, clicking the ‘Data Streams’ tab, and then clicking on your Data Stream.)
- Click on the ‘Triggering’ box.
- Click ‘All Pages.’
- Click the ‘Save’ button.
Add Google Tag Manager to WordPress Without Plugins
While plugins are available for these steps, I found the same amount of work/complexity involved when using those plugins. Also, I prefer to do the job without adding additional plugins to the mix when it makes sense.
If you’re not already, I recommend you use a child theme so the changes we make here are not lost when you update your parent theme.
- Connect to your website via FTP using a solution like FileZilla. (Note: As a general rule, you should always have access to your website via FTP for troubleshooting purposes and general file management.).
- Browse to your parent theme (wp-content > themes).
- Download the header.php file from your parent theme to your local workstation.
- Edit the downloaded header.php file using your preferred text editor.
- Pull up Google Tag Manager and go to the ‘Admin’ tab.
- Click ‘Install Google Tag Manager.’
- Copy/paste the code snippets into the header.php file and save using the straightforward instructions provided.
- Using your FTP client, browse to the child theme folder.
- Upload your edited header.php to the root of your child theme folder.
Add Google Tag Manager to WordPress With Plugins
Important: Choose either Perfmatters or SEOPress to implement your Google Tag, not both.
Perfmatters
- Google Tag Manager > Click the ‘Admin’ tab.
- Click ‘Install Google Tag Manager.’
- In another browser tab, navigate to WordPress Dashboard > Settings > Perfmatters > Assets > Code.
- Add Header Code > Paste in your code snippet from step 2.
- Add Body Code > Paste in your code snippet from step 2.
- Click the ‘Save Changes’ button.
SEOPress
- Google Tag Manager > Click the ‘Admin’ tab.
- Click ‘Install Google Tag Manager.’
- In another browser tab, navigate to WordPress Dashboard > SEO > Google Analytics.
- Google Analytics > Enable
- [HEAD] > Paste in your code snippet from step 2.
- [BODY] > Paste in your code snippet from step 2.
- Save changes.
Verify Google Analytics Tracking
- Open a browser and ensure you’re not logged into your website from that browser.
- Google Tag Manager > Click the ‘Workspace’ tab.
- Click on the ‘Preview’ button in the upper right corner of your screen.
- Enter your website URL.
- Click the ‘Start’ button.
- If all goes well, you should see a message that states you have successfully connected.
- Click the ‘Continue’ button.
Google Tag Manager Assistant
At this point, Tag Assistant will open a new window (“Debugger”) in your same browser, displaying the corresponding page you entered in step #3.
Once you start interacting with your website, the Tag Assistant browser tab will show things “firing.” At that point, you know Google Tag Manager is working.
As long as you keep this window open, you remain in ‘Debugger Mode,’ where you can review the Tag Assistant browser tab to see how things are working/not working.
- Close the “Debugger” browser window to disconnect and exit debugging mode.
Add Facebook Pixel Tag to Google Tag Manager
- Go to your Pixels tab in Facebook Event Manager.
- Click the ‘Get Started’ button in the ‘Facebook Pixel: Track Website Activities’ section.
- Put in your website name for your Pixel Name.
- Put in your website URL.
- Click ‘Create.’
- For the ‘Install Facebook Pixel’ dialog box, click ‘Connect a Partner Platform.’
- Choose ‘Google Tag Manager.’
- Click ‘Continue.’
- Enable ‘Turn On Automatic Advanced Matching.’
- Click ‘Continue.’
- Choose your Google account.
- Select your desired Google Tag Manager account and container.
- Close.
- Google Tag Manager > Click ‘Triggers.’
- Click ‘New.’
- Click the ‘Trigger Configuration’ box.
- Choose ‘Page View.’
- Click ‘Save.’
- Click ‘Save.’
- Click the ‘Submit’ button in the upper right of your screen.
- Click ‘Publish.’
- Click Skip’.
Verify Facebook Pixel Tracking
- Go to Facebook Event Manager.
- Select your Data Source (it should be the name of the Pixel you just created).
- Go to the ‘Test Events’ section.
- Browse your website pages.
- Look back in the Test Events section, and you should see Page View entries appear under Receiving Activity.
Note: If you don’t see any activity, try viewing your website using a different browser than the one you’re logged into when configuring your Facebook Pixel and using the same browser in Private/Incognito mode.