No products in the cart!
Please make your choice.View all catalog
Updated: May 7th, 2021
If you’re just starting with web tracking and have absolutely no prior technical knowledge of the web, you might be confused about which Page variables (in Google Tag Manager) to use when. Questions like “what is the difference between Page Path and Page URL?” might be quite common.
That’s why I’ve decided to publish a quick guide comparing Page Path vs Page URL so that you would have a better understanding of it.
By the way, if you want to learn more about Page variables and Pageview Triggers in GTM, go ahead and read this guide.
Page Path returns way less info compared to the Page URL.
Page Path returns only what comes after the hostname (domain) but before:
It just returns the subdirectory (page) on which you currently are.
If you want to also use query parameters (e.g. utm_parameters) in your triggers, then the Page Path variable is a wrong choice. You should instead use the Page URL because it returns:
To sum up, the difference between the Page URL and Page Path is that Page URL returns almost the entire URL while Page Path just returns the value that comes after the hostname (but before the query parameter).
Here’s an image that should give you a better understanding.
If on the other hand, you want to isolate and access only other parts of the URL (but without getting the full URL, you will have to rely on custom page variables. Continue reading and I’ll show you how.
Another amazing thing about GTM is its customization possibilities. If the built-in functionality is not enough for you (it probably won’t), you can do some awesome user-defined stuff.
In Google Tag Manager’s interface, go to Variables and scroll down till you see the User-defined variables section. Click new and choose the URL variable.
The URL Variable can be used to access components of the current page URL. This is a very versatile Variable type, and is especially useful for traversing query parameters and hash fragments in your URLs. Note: There are Built-In Google Tag Manager Variables for some situations (i.e. Page URL, Page Hostname, Page Path).
Let’s say the address of the web page that I am currently on is https://www.example.com/welcome:8080?gclid=aabbcc123#home. Now I will describe every component type that is available in the URL variable:
You can expand the More Settings tab to find a source selector. In this selector, you can choose the Variable whose return value the URL Variable will access (for example, Click URL). But by default, the URL variable returns parts of the Page address.
To sum up, Page Path returns the part of URL that comes after the hostname (domain) and before the query parameters, URL fragment, or port. An example of this could be /pages/contact-us/.
Page URL returns more information about the web page address (includes the protocol, hostname, page path, port, query parameters). An example could be https://www.example.com/pages/contact-us/?ref=internal-banner.