Unify Facebook referrals in Google Analytics

We use various tricks to make our work more efficient and measurement simpler.

Jakub Gombár

Jakub Gombár

Co-Founder

30. June 2020

3 min

Advanced

We use various tricks to make our work more efficient and measurement simpler. You need not be a PPC guru to check your own ads' performance or review various statistics in Google Analytics. If you measure Facebook performance through Google Analytics you have certainly come across various Facebook referrals. What are they for and how can we unify them easily?

Contents

How does Google Analytics measure traffic from Facebook?

By default Google Analytics sees people arriving on your site from Facebook as a referral, meaning visits that reached your site by clicking a link on another site. In this case they are people who found your link in the Facebook app and on the Facebook website.

Traffic is measured in Google Analytics as a set of different referral sources. Here is an example of what you will find in the Acquisition – All Traffic – Source/Medium report:

Google Analytics – Source/Medium report with several separate Facebook referrals

That makes things slightly harder when you want to work out the total number of people who found your site on Facebook.

The most common Facebook referrals you will find in Google Analytics reports are:

m.facebook.com

l.facebook.com

facebook.com

lm.facebook.com

But you may also find other Facebook referrals such as:

business.facebook.com

free.facebook.com

web.facebook.com

mtouch.facebook.com

mbasic.facebook.com

apps.facebook.com

mobile.facebook.com

m.latest.facebook.com

touch.facebook.com

intern.facebook.com

Why are there different Facebook referrals?

Facebook referrals appear for two main reasons:

  1. Facebook is available on several different subdomains.
    m.facebook.com, for instance, is the referral when people view your content in the Facebook app on their phone. Another example is free.facebook.com, a lightweight version of Facebook that can be reached in some countries without people being charged for mobile data.
  2. Facebook uses redirects to protect its users.
    Facebook redirects the user to your site through the "Link Shim" feature. It is a Facebook tool that protects users' privacy and checks whether the web address somebody is about to visit is on a list of dangerous sites. That list comes from its own database and from those of McAfee, Google, Web of Trust and Websense. A visit arriving from the lm.facebook.com referral is the same as l.facebook.com, with the sole difference that the user came from mobile.

How can you "tidy up" these Facebook referrals?

Applying a view filter in Google Analytics is the best way to tidy up Facebook referrals. The filter lets you combine all the different Facebook referrals into one.

  1. At the bottom left click the Admin icon and then FiltersGoogle Analytics – view admin with an arrow pointing to Filters
  2. Create a new filter, give it a name and choose Custom as the filter type. Then choose "Search and Replace" and pick "Campaign Source" as the Filter Field. Copy the following into the Search string and Replace string fields:

Search string: .*\.facebook\.com

Replace string: facebook.com

This filter finds any source containing the domain .facebook.com (which will cover every Facebook subdomain) and replaces it with the string "facebook.com".

Google Analytics – custom Search and Replace filter unifying Facebook referrals

All your traffic should then appear as a single Facebook referral.

Google Analytics – Source/Medium report with a single unified facebook.com referral

So if you want to keep Google Analytics clear and tidy, consider adding a view filter that combines all the different Facebook referrals in your reports. And if you are running paid ads on Facebook, it matters to use campaign tags — UTM tags — on every link bringing traffic to your website. That tagging lets you compare the performance of paid and organic posts and understand the return on your ads — but more on that another time.

Recommended reading

The latest trends, proven practices and analyses from the digital world. Find out how to take your technology and marketing growth further.