Web analytics

Facebook parameter fbclid in URL and his removal.

What happened?

Facebook has started adding the parameter fbclid (Facebook Click Identifier) ​​to the URL of a click from Facebook posts.
This parameter appears only in the web version of Facebook, both on the destop and mobile versions of the web, it has not appeared anywhere on Andriod or IOS applications.

What is it used for?

Thanks to this parameter, Facebook will find out, ie if there is an FB pixel on the given end URL, what happened on the given end site in the given browser window. He will combine visits better and will have even more data. If Facebook cancels a third-party cookie, Facebook will tag and connect you in this way.
Does this parameter help anyone other than Facebook’s internal analytics?
As far as I know, no one knows. As it hurts more than it helps, I’d like it to disappear and maybe disappear.

The view of an SEO specialist

The fbclid parameter can be indexed and cause duplicate problems. Another problem is with the links, because their quality is reduced there. For organic sharing, users may leave this parameter in the URL.
From an SEO perspective, therefore, it can be harmful.

The view of a web analyst

Deciding to analyze the site, you will need to manually link and fix it in reporting.

From the point of view of a Social media marketer

So I don’t know about anything that would help the parameter and it would be known about it. The only risk is that users will organically share this content with this measurement parameter and it will still spread.

From the perspective of PPC specialist.

Problem with exact match on a given URL and therefore a problem with a smaller audience for remarketing.

From the point of view of UX specialist

The problem with exact match on a given URL, as with PPC, will only be in the tools for scanning heatmaps etc. where in the given sample there will be no Facebook users. Furthermore, the user’s path through the web to many individual landing pages will be comminuted instead of the correct one.

From the user’s point of view

An ugly URL that he doesn’t forget and that’s just what’s extra, it’s more annoying. When sharing, it can happen that someone then shares the links with this parameter and makes it an even bigger problem.


1) Leave the parameter in the URL and fix it where needed.


  1. Canonical URL – recommendations for indexed URLs. It can help protect against indexing in SERP, but it still often indexes URLs with this parameter.
  2. Disable in robots.txt – crawl budget optimization. You call robots, don’t waste time crawling through these links.
    Disallow: /*?*fbclid=
  3. Disable indexing in meta robots at the top of the page. – The surest protection against indexing of a page with a parameter. The condition is when there is a change in meta robots in the URL to:
    <meta name="robots" content="noindex" />
  4. Exclude a parameter in the Search console. Set here that it is a passive parameter and does not affect the content.

Web analytics:

  1. Modify the analytics so that only treated URLs fall into GA and other tools. For me, it’s a good idea to send the right URL to your own dimension. The code is at the bottom of the page.

A detailed look at data correction in Google Analytics

Everything you do will be corrected only by the newly measured data.

Correction via parameter exclusion in Google Analytics

  • Easy repair
  • The need for edit rights in a given view of data in Google analytics.
  • With a boring repetitive repetitive repair profile, it is not a systemic one, a need to remember it in the future.
  1. Go to Google analytics
  2. Go to GA> Admin> View setting
  3. Add “fbclid” to “Exclude URL Query Parameters” there
  4. Impose
  5. Repeat on all views where you want to fix it.

Google tag manage script variable for URL correction for Google Analytics


Because you have 100+ Google analytics and you don’t even have access to some, and yet you want to exclude it from all GAs and you can only solve it via GTM. In addition to the parameter, you want to cut out from the URL others that just make a mess there.

  1. Go to Google tag manager.
  2. Create a variable.
  3. Test her.
  4. Go into your Google analytics setting variable so you don’t have to put it manually in each tag.
  5. Use the page parameter in the fields and equal this variable.
  6. Test
  7. Publish.
// Marek Lecián 9.11.2018 
function () {
	function removeParam(key, sourceURL) { 
		var rtn = sourceURL.split("?")[0],
		params_arr = [],
		queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
		if (queryString !== "") {
			params_arr = queryString.split("&");
			for (var i = params_arr.length - 1; i >= 0; i -= 1) {
				param = params_arr[i].split("=")[0];
				if (param === key) {
					params_arr.splice(i, 1);
			rtn = rtn + "?" + params_arr.join("&");
		return rtn;

	function removemultipleParams(keys, sourceURL) {
		var myurl = sourceURL;
		var paramstoremove = keys.split(",");
		for (var i = 0; i < paramstoremove.length; i++) {
			myurl = removeParam(paramstoremove[i], myurl)
		return myurl;

	return removemultipleParams("fbclid,",window.location.pathname +

I extended this script to work for more parameters and modified it for measurement purposes of Google analytics.

In addition to this purpose, I also use it to cut off some parameters that I simply do not want in analytics or prefer in my own dimension.

Other variants:

More parameters:
removemultipleParams ("fbclid, dalsi_parametr, adalsi,", window.location.pathname +}

Add a hash:
removemultipleParams ("fbclid," window_location.pathname + + window.location.hash

Parameters via variable:
removemultipleParams ("{{your variable}},", window.location.pathname +

Full URL:
removemultipleParams ("fbclid," window.location.href)


2) Total deletion of the parameter directly on the server.

Don’t do it if you don’t understand.

I am not responsible for your deployment…

This is a general guide that may not know the specifics of your server settings.

The advantage of this solution:

  • Treat everything at once.
  • It works even without JS.
  • However, I still recommend implementing canonical and robots.txt editing.
  • The best permanent solution


  • You need a developer or someone who can set the thing on the server, but it really pays off 😉. If you have a good developer, he will do it for you, you won’t even know about it 😀.

Repair via Htaccess

RewriteCond %{QUERY_STRING} ^(.*)&?fbclid=[^&]+&?(.*)$ [NC]
RewriteRule ^/?(.*)$ /$1?%1%2 [R=301,L]

Fix via Htaccess if you have wordpress WordPress:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)&?fbclid=[^&]+&?(.*)$ [NC]
RewriteRule ^/?(.*)$ /$1?%1%2 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Another view is file caching, where it is ideal to set caching to ignore this parameter.

If you do not dare to do so, ask to remove this parameter from the URL of your developer. Request a 301 redirect that removes the parameter from the URL and redirects back to the original URL.

3) Wrong solution for me.

Javascript to remove a parameter from a URL by moving the URL of an already loaded page.

  • The fbclid parameter can be indexed by Google and the List (no js), expect SEO problems.
  • For a website that counts, they use a trigger history change (change of url in the loaded window) in the analytics will fire another pageview> bouncerate 0%. It applies to websites built on javascript with the possibility of auto tracking of URL changes.
  • Depending on the location of the replace URL and the GA script, a nice URL will or will not be sent, it may also depend on the speed of the Internet.
  • It can make a mess in UX tools, where the URL change will be measured. Another problem will be with the exact match.

4) Ignore

  • SEO – Duplicity will decide for you
  • In analytics, you will have a hard time connecting data.
  • The worst idea in the long run will annoy you and steal time with every data fix.


What did I do on my blog?
I wanted to do this via a redirect on the server, but a proxy loadbalancer, what is on the server destroys my effort. So I’m currently eliminating at the GA level and trying to work it out. On other sites where I do not have such convenience, it works for me 🙂.
What did I do with the client’s blog, where I am not able to contact the developer?
I excluded the parameter in GA and maybe the developer will fix it there according to the instructions.
What was the complicated client doing?
The first exclusion in GTM 😉 and then we will probably exclude it via rewrite on the server.
So at least in short why I give such an extensive guide 🙂 .

Do you have ideas for expanding the article? 
Or its modifications? Email me or contact me on social media.