FBCLID is Facebook’s Click Identifier – a query parameter appended to all links posted on Facebook since 2018.
In response to browsers clamping down on third-party cookies, this FBCLID identifier serves a purpose when it comes to reporting specifically within the Facebook interface but in Google Analytics, this unique identifier can cause major disruption to your data, splitting what you would consider one URL into multiple rows in your reporting (example below from Universal Analytics).
We addressed how to remove the FBCLID parameter in Universal Analytics in a previous blog post but with GA4 the new normal, now seems like a good time to revisit this topic and see how it affects the latest version of Google Analytics.
Does FBCLID parameter affect data in GA4?
The good news is that the standard GA4 reporting for pages uses Page Title and Page Path as the default dimensions.
Note: ‘Page Path’ is the part of the URL that comes after the hostname (domain) and before any query parameters, URL fragments, etc.
This means that on face value, GA4 doesn’t report on any query parameters appended to URLs if you’re simply looking at the standard page reports.
However, if you dig further in GA4 and build your own Exploration Reports – maybe you want to report on the performance of some pages which have query parameters that you are interested in – then you will see a Dimension called ‘Page Path + query string’.
This dimension WILL include all query parameters appended to the URL, including FBCLID. When we look at the values of this dimension, much like we saw in Universal Analytics before, a fragmented list of URLs appear here in GA4 with a unique value for each time a user has clicked on a link via Facebook and ended up on your site.
How to Remove FBCLID parameter in GA4
So what do we do about it? How do we get rid of FBCLID in GA4?
The bad news is that at the time of writing, there is no way to exclude specific query parameters within the GA4 interface, as we could do quite simply in Universal Analytics previously.
The good news is, although it’s a bit more complicated, we can still do it via Google Tag Manager. The process involves stripping the FBCLID parameter (and any other unwanted parameters) from the URL, rewriting the ‘page_location’ field in our GA4 tag, then sending the ‘page_view’ event to GA4.
The easiest way to do this is to install a Variable Template from the GTM Community Gallery called ‘Trim Query’ by Ayudante following these steps:-
1. Click on ‘Templates’ then click on ‘Search Gallery’ under the ‘Variable Templates’ section.
2. Search for ‘Trim’ and then click on ‘Trim Query’ by Ayudante. On the next screen, click on the blue ‘Add to workspace’ button, top-right.
3. You’ll then be asked to give the template permissions – allow it.
4. Once you’ve added the Template, click on the ‘Variables’ folder on the left, then scroll down to User-Defined Variables and click ‘New’.
5. You should then see the new ‘Trim Query’ variable type listed as the top option under Custom Templates. Select it.
6. Set the Target URL as ‘Page URL’, tick the ‘Remove from Queries’ box and ‘black list’ from the drop-down. Enter ‘fbclid’ as the query key to remove. If you want to remove any other parameters, add each one as an additional row here. Once you’ve configured accordingly, save this new variable.
7. Next, we want to overwrite the ‘page_location’ field in our GA4 configuration & pageview tag. You can do this by expanding the ‘fields to set’ in the tag setup, type ‘page_location’ in the Field Name box to the left and select your newly created variable in the corresponding Value box to the right.
8. Finally, remember to publish your workspace changes as usual!
This won’t affect historical data but once completed, you’ll no longer see FBCLID in newly collected GA4 data. If you have any trouble following the steps above or have any further questions, feel free to leave a comment below or get in touch, we’re always happy to help.