How To Exclude FBCLID Parameter from Google Analytics?

Google Analytics

Since October 11, 2018, lots of Google Analytics users have been scratching their heads and asking:

1. Why am I seeing a fbclid query parameter in my Google Analytics pages report? What is it?
2. Should I care about it? Do I have to change something in my Google Analytics configuration?

fbclid google anaytics example
This “?fbclid” regex will help you figure out all pages that include “fbclid” parameter.

Let’s say that you want to analyze the performance of this landing page: /en/campaigns/

Glancing at the results, you might notice that it has been one of the most popular landing pages on the site. It seems like 20,764 sessions have started on this page in the past 2 weeks.

landing page report and fbclid
20,764 sessions started on the “/en/campaigns/” page in the last 2 weeks?

Now, if you dig deeper and enter this regular expression “/en/campaigns/$|/en/campaigns/?” to the Table Filter in Google Analytics, you’ll notice that it was actually 21,207 sessions that started on this page during the last 2 weeks, not 20,764. That’s a difference of 443 sessions.

landing page report and fbclid problem
No, actually 21,207 sessions started on the “/en/campaigns/” page in the last 2 weeks!

The fact is that (?fbclid=…) query parameter values split URLs in your Google Analytics reports across tens, hundreds, or even thousands of different rows. Hence, all associated metrics (pageviews, bounce rate etc) are all broken up. This can make cohesive analysis of your data more difficult— or even impossible in some cases.

How can you exclude the FBCLID parameter from your Google Analytics view?

There are 2 options:

1) Your can use the built-in Exclude URL Query Parameters setting. Use this option if you don’t have lots of different views in your Google Analytics property.

2) You can create filters that will exclude this query parameter from URLs. Use this option if you have lots of different views in your Google Analytics property. It will help you speed up the process of implementing this exclusion to all the different views so you don’t have to do them one-by-one.

First Option: Use the built-in Exclude URL Query Parameters setting

1. Open the Admin section in Google Analytics by clicking the gear icon (⚙) in the bottom left corner.

google analytics admin section

2. Navigate to View Settings under the View column.

google analytics view settings - fbclid

3. Find the Exclude URL Query Parameters (optional) setting under the View Settings and enter “fbclid” parameter to this field. Do not include a question mark (?) or an equal sign (=) with the parameter.

fbclid query parameter

P.S. You need to have Edit permission at the view level to apply this change.

If you or someone else in your team have previously added some query parameters to this field, keep them as they are and just add “fbclid” on to the list. Be sure sure that it’s a comma-separated list.

4. If you’re sure that you’ve done everything correctly, click the SAVE button.

Second Option – Use View Filters

1. Open the Admin section in Google Analytics by clicking the gear icon (⚙) in the bottom left corner.

google analytics admin section

2. Navigate to All Filters under the Account column.

All Filters in Google Analytics

3. Create a first view filter by clicking the +Add Filter button.

Add Filter in Google Analytics

P.S. Only Google Analytics users who have Edit permission at the account level can:

  • Create/edit filters at the account level
  • Create/edit filters at the view level
  • Apply filters to any view in the account

If you have Edit permission at the view level, you can only apply existing filters to or remove them from that view, but you cannot create new filters or edit existing filters.

If you don’t have sufficient permissions to apply new filters, get in touch with the person who has administrator access to your account.

4. Configure the first view filter needed in Google Analytics:

1) Choose the right method: Create new Filter
2) Filter Name: Search and Replace – Exclude fbclid Query Parameter from URLs
3) Filter Type: Custom
4) Filter Subtype: Search and Replace
5) Filter Field: Request URI

Search and Replace - Exclude fbclid Query Parameter from URLs

5. Fill in the Search String and Replace String fields of the first view filter:

1) Search String: (fbclid=[^&]*&?)
2) Replace String:

search string and replace string

You should leave the replace field blank since we want to take out everything that’s in parentheses and leave it empty.

6. Create a second view filter by clicking the +Add Filter button:

Add Filter in Google Analytics

7. Configure the second view filter needed in Google Analytics:

1) Choose the right method: Create new Filter
2) Filter Name: Search and Replace – Strip out trailing ‘?’s or ‘&’s on page paths
3) Filter Type: Custom
4) Filter Subtype: Search and Replace
5) Filter Field: Request URI

Search and Replace - Strip out trailing ‘-’s or ‘&’s on page paths

8. Fill in the Search String and Replace String fields of the second view filter:

1) Search String: ([?&]$)
2) Replace String:

search string and replace string 2

Leave the Replace String field blank again.

Note: This second filter should also be created to strip out trailing ‘?’s or ‘&’s on page paths. The first filter we created will grab the query word and value but not the character before it (‘?’ if it is the first query in the URL and ‘&’ if it is not) We do it like that because we’re not sure if there will be one or more query parameters in the URL.

9. Apply both filters to desired views in your Google Analytics account.

Make sure you don’t add any filters to your Raw Data View.

Apply filters to views

10. If you’re sure that you’ve done everything correctly, click the SAVE button.

11. Make sure you have the correct filter order

Filter order matters in Google Analytics. Navigate to Filters under the “View” column and take a look at the order of the filters applied to your view.

Make sure that the first filter “Search and Replace – Exclude fbclid Query Parameter from URLs” created is placed before the second one “Search and Replace – Strip out trailing ‘?’s or ‘&’s on page paths”.

Filter order in Google Analytics

If the order of the filters is incorrect, you can change it by clicking the Assign Filter Order button. Make sure you change it in each view.

Filter order matters in Google Analytics

Bonus: If you would like to save time, you can easily download both filters described in this article to your Google Spreadsheet document and import to your desired Google Analytics account using the Filter Management for Google Analytics add-on.


Things to keep in mind:


1) This configuration will only affect data going forward so that the past data collected to your Google Analytics won’t be affected. It’s not possible to retroactively delete or edit any data in Google Analytics.

2) Make sure you apply this change to all the necessary viewsin your Google Analytics property. You should at least have it configured in the Master View and Test View.

3) Add new annotations to your Google Analytics views that you modified, and inform your colleagues that you have made changes in Google Analytics settings on the view level.

Summary

We hope you find this article useful and that it saves you both time and tons of potential headaches in the future so you don’t have to struggle with this “fbclid” query parameter in Google Analytics anymore.

Extra reading materials on the subject:

Please let us know in the comments if you know more details about the “fbclid” parameter.

You must be logged in to post a comment.
Share
Share
Tweet