Targeting the Home Page with Google Tag Manager

Recently I was adding a code snippet to a website, with the explicit requirement to not include the code on the home page. This was being done via Google Tag Manager, and we already had some triggers in place to target the home page, great!

Until I went to test, and it turns out the triggers, some of which were actually in use, were not configured properly.

I did a little digging to figure out how exactly I need to be targeting the home page. Surprisingly, a lot of the stuff I read out there was close, but not quite right.

Honestly, I’m a bit surprised that Google didn’t include an easy way to create a trigger for the home page. Every site has one after all.

So what’s the secret sauce?

  1. Create a New trigger
  2. With a trigger type of Page View
  3. This trigger fires on Some Page Views
  4. Fire this trigger when Page Path matches RegEx ^/$
  5. Click Save

Here’s how the form should look:

Shockingly simple, that’s was I was surprised to find so many attempted methods to do this. Maybe some of those methods worked previously, who knows.

With the trigger created, you can use it to include tags on the home page, or exclude the home page from having certain tags.

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.