Here’s a simple way to check what was the source of the visitor’s arrival to the current page. It’s done by utilizing the {{referrer}} macro, which comes out-of-the-box in any GTM setup.
The Simmer Newsletter
Follow this link to subscribe to the Simmer Newsletter! Stay up-to-date with the latest content from Simo Ahava and the Simmer online course platform.
Tip 2: Use {{referrer}} to see where the visitor came from
You might want to also explore the Component Types and create new macros for {{referrer path}} and {{referrer host name}} for example:
By default, you see, the {{referrer}} macro returns the entire URL of the previous page. Sometimes it’s more economical to check only against the URL Path or the Host Name of the previous page. This is where the Component Types kick in.
Also, remember that if the previous page was not on the current domain (i.e. it’s an entrance to the site), this shouldn’t automatically be treated as the landing page of the session, when thinking in Google Analytics terms. A session can include many entrances to the site, if they occur within a 30 minute time window and if they are direct or cross-domain traffic.
This tip is useful if you want to fire tags or populate macros depending on if the user came from a specific location, for example one of your social media channels.