How to trigger tags only on a landing page using the Google Tag Manager.
Besides the event tracking, page view tracking, and advertising pixel placement, Google Tag Manager also has a way to trigger tag only on the first page where user lands and sessions begin which is also known as a landing page.
This article is based on my experience where I was facing an issue to fire a tag only on the landing page. The first step towards this problem was to Google and see whether there is any related article, I was quite amazed that there was not even a single article even close to the solution of this problem.
Let’s go through some situation where you will need this tag, and then really dive into Landing Page Trigger.
- When you want to capture source and medium manually and pass it to the Campaign Manager (Formerly called DCM) or Google Analytics
- When you want to capture and pass the traffic source whether paid or organic to the Campaign Manager (Formerly called DCM) or Google Analytics. For example, if referral URL is google.com and doesn’t contain the UTMs or GCLID (if auto-link with the Google Ads) then it is an organic traffic else it is a paid traffic. Like Google Analytics the Campaign Manager doesn’t capture the traffic source, so we can capture it and pass to the Campaign Manager variable.
- When you want to fire certain publisher pixel only on the Landing Page
Now we’re getting to the good stuff! Let’s understand how we will achieve this, I will going to use the referral URL here. The referral URL is a previous page URL.
So, when users arrive at your website from Google Search or some other website then the referral URL will be “google.com” or “SomeOtherWebsiteURL.com“. When the user navigates within your website then referral URL will be your website URL.
Now, the Google Tag Manager captures the referral URL in a default variable called Referrer. The idea is to make use of that variable and fire our tag. Whenever the referrer value doesn’t contain your website URL then fire the tag because it means the user has arrived from another website or google search.
The trigger set up will look like below: