GA4 Tip: The page_location parameter

Chris Vu
Sparkline
Published in
2 min readAug 2, 2024
Photo by Goh Rhy Yan on Unsplash

page_location is an important parameter in GA4. It represents the website URL that a GA4 event is recorded on.

When the page_location parameter is not manually specified, GA4 will automatically take the actual URL (ie. what you see on the browser address bar). For example, a blog page may have a URL that looks like:

https://www.mywebsite.com/b?article=12345&utm_source=newsletter&utm_medium=email&utm_campaign=2024xmas

Tip #1: Ensure Full URL

You can manually specify the page_location parameter if you want to record a different URL from the actual browser URL. For example, in the above example, you may want to change the page path from /b to /blog.

MAKE SURE that the page_location is a FULL URL, including the protocol, domain name, page path, and query parameters.

Some incorrect examples:

  • page_location = blog
    GA4 will be record this as https://blog which is just wrong.
  • page_location = https://www.mywebsite.com/blog
    There are no URL parameters, GA4 will NOT be able to record the UTM parameters and you will lose the traffic source attribution.

A correct example:

  • page_location = https://www.mywebsite.com/blog?article=12345&utm_source=newsletter&utm_medium=email&utm_campaign=2024xmas

Tip #2: Do NOT change URL query parameters casing

When recording data to GA4, it’s generally a good idea to lowercase all values so that you have a consistent reporting experience. For example, instead of seeing 2 rows like:

  • newsletter / email, 4000 sessions
  • newsletter / Email, 1000 sessions

You should be just be seeing a single row:

  • newsletter / email, 5000 sessions

However, when specifying the page_location parameter in GA4, do NOT lowercase the URL parameters as the casing may have important identification mechanism.

For example, when clicking on a Google Ads link, you may see the URL like this with the added gclid URL parameter:

https://www.mywebsite.com/?gclid=A5jGujlptiIILDLaJZjVM6F

An incorrect example:

  • page_location = https://www.mywebsite.com/?gclid=a5jgujlptiiildlajzjvm6f
    The gclid is case sensitive. If you change it to lowercase, in GA4 when you integrate with Google Ads, you will NOT be able to correctly attribute the traffic source and conversions.

Sparkline aims to provide data accuracy, comprehension and consolidation, and most importantly, tangible insights for businesses. Get in touch if you’d like to find out more about GA4.

--

--

Chris Vu
Sparkline

How did my life bring me to this point being a technical consultant in digital analytics and optimization, I have no idea…