In this Insider’s Guide to GA4 series, I will share all the practical tips you need to know when working with the new version of Google Analytics. The first post in the cycle is dedicated to setting the Full URL as a custom dimension. Let’s roll up the sleeves and do it.
Why do you need it?
- by default the query parameters are not removed from URL and split the page addresses into several instances
Do I need to add anything in GTM?
You need to create one simple Custom JavaScript variable.
How to setup this up?
1. Go to Google Tag Manager -> Variables -> new Custom JavaScript variable
function(){
return document.location.hostname + document.location.pathname;
}
2. Navigate to your GA4 tag, click to “Fields to set” and add a new field with the value “page_location” and set the value to the new CJS variable.
3. The page location will begin to appear in your reports after about 48h.
[convertkit form=2038871]