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?
- Create a New trigger
- With a trigger type of Page View
- This trigger fires on Some Page Views
- Fire this trigger when Page Path matches RegEx
^/$
- 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.