How to Fix m/lm/l.facebook.com in Google Analytics

Google Analytics

We’ve recently come across lots of digital marketers scratching their heads and asking:

  1. Why am I seeing all these unconventional Facebook referrals (lm.facebook.com, l.facebook.com, m.facebook.com, web.facebook.com etc.) in Google Analytics? 
  2. Why are they split across different rows in our Google Analytics reports?
  3. How can I combine all Facebook referrals in one for better reporting?
Google Analytics: l.facebook.com, lm.facebook.com and m.facebook.com referrals

Are you struggling with the same problem? 😞

This article will show you exactly what’s hidden behind these mysterious Facebook referrals and what can be done to avoid having your Facebook data split across several rows in your reports (how to fix m/lm/l.facebook.com in Google Analytics.)

How to Fix m/lm/l.facebook.com in Google Analytics

Yes, we’ll show you how to fix this. 🤓Image Source

Contents

  1. What’s hidden behind these baffling Facebook referrals?
    a) What is l.facebook.com / referral in Google Analytics?
    b) What is lm.facebook.com / referral in Google Analytics?
    c) What is m.facebook.com / referral in Google Analytics?
  2. Is it worth combining all those Facebook referrals together?
  3. How to combine all these mysterious Facebook referrals in one?

1. What’s hidden behind these baffling Facebook referrals?

Facebook’s primary goal is to protect its users from malicious and spammy content and that’s why they have built a powerful tool called the Link Shim.

l.facebook.com and lm.facebook.com are called Link Shim referrals. Their presence in Google Analytics indicates that your website was evaluated favourably by the Link Shim system developed by Facebook.

Every time a link is clicked on the site, the link shim system will check that URL against a huge internal database of malicious links.

If the system detects that the link you’ve clicked on is malicious, it redirects you to an interstitial page that warns you and gives you an option to return to Facebook.

Facebook link shim - warning

If the link you clicks looks malicious or spammy, Facebook will give you a warning. ⚠


If everything is fine with the website you’re planning to visit, you’ll be automatically redirected from an interstitial page to the final URL.

Keep in mind, every user who clicks on an external link on Facebook, is temporarily redirected to a link shim page, before being sent to the final URL. This is because Facebook needs to rewrite referrer data for security reasons. 

P.S. If you see lots of different referrals (l.facebook.com, lm.facebook.com, m.facebook.com etc) in your reports, it doesn’t necessarily mean that you website is malicious or spammy.

There’s a number of reasons for this link shim interstitial page being served:

1. Facebook wants to keep you away from malicious websites

Like mentioned before, Facebook is able to run a check at the time of a click (i.e. when a user clicks on an external link) and if they detect a malicious website, they will give you a warning.

It prevents us from seeing malicious or spammy content and that’s great.

2. Facebook wants to protect its users’ privacy and identity

Facebook wants to hide personally identifiable information (PII) from third party websites and the link shim tool is used to rewrite Facebook referrers.

For example, it removes usernames from referrer URLs, before web browsers send you to external websites so that your 3rd party analytics tools (Google Analytics for example) are not able to reveal who it is that clicked on the link (meaning the owner of the 3rd party website will not know your name when you click on their link).

Businesses often use Google Analytics UTM parameters to track the performance of different marketing campaigns.

3. Facebook wants to make your external analytics tools more accurate

By default, HTTPS websites do not send referrer data to HTTP (non-HTTPS) websites due to security reasons. If someone navigates from a HTTPS website to your HTTP website, the browser doesn’t send a referrer header (the document.referrer will be empty). This means that you’ll see that he/she came to your site directly (you’ll see direct / none in Google Analytics).

It was a problem for Facebook because there was a huge number of users using the platform over HTTPS and lots of 3rd party analytics tools were not able to correctly record traffic coming from Facebook.

Facebook solved this problem by routing the click through the link shim page that is a non-HTTPS page. Users will stay on the temporary link shim page a few milliseconds before being redirected to the desired web page. This is why you see an anonymous Facebook referrer rather than a referrer from an unknown source (direct / none) in Google Analytics.

a) What is l.facebook.com / referral in Google Analytics?

It’s a link shim referral generated by Facebook.

What is l.facebook.com / referral in Google Analytics?

l.facebook.com is a link shim referrer for desktop devices. 🖥️


Facebook is not consistent with the naming conventions of its referral data and that’s why we’re seeing this l.facebook.com referral source in our Google Analytics reports. Technically, all the traffic from l.facebook.com, lm.facebook.com, facebook.com and m.facebook.com is the same it’s all Facebook traffic. The prefixes l. ; lm. ; m just indicate different devices (desktop and mobile).

P.S. Again, these prefixes are added to the referral in Analytics because every user who clicks on an external link on Facebook, is temporarily redirected to a link shim page, before being sent to the Final URL.

b) What is lm.facebook.com / referral in Google Analytics?

It’s also a link shim referral and it has exactly the same purpose as l.facebook.com. It just indicates mobile traffic.

What is lm.facebook.com / referral in Google Analytics?

lm.facebook.com is a link shim referrer for mobile devices.📱

c) What is m.facebook.com / referral in Google Analytics?

This referral shows traffic that has come from mobile devices. The regular one “facebook.com” indicates traffic from desktop devices.

What is m.facebook.com / referral in Google Analytics?

m.facebook.com just shows Facebook traffic from mobile devices.📱

2. Is it worth combining all Facebook referrals?

Yes, if you’d like to make it easier to gain valuable insights and you’re tired of seeing Facebook traffic split across multiple rows in Google Analytics.

Here’s how it looks like if you haven’t combined your Facebook referral data:

Facebook referrals: combining m/lm/l.facebook.com into one

Use a table filter or an advanced segment to find all Facebook referrals.


Here’s how it looks like if you’ve combined your Facebook referral data:

Combining m/lm/l.facebook.com: one Facebook referral

For analytics purposes, we recommend combining all Facebook referrals together so that you don’t need to use table filters or apply advanced segments to your reports every time to pull insights out of your data.

Keep in mind that if you combine these different sources together, you’re still able to segment your data later however you want (by the device, city, browser etc).

You can also keep one view unfiltered so that if needed you can analyze these separate referrals in the future.

3. How to combine all these mysterious Facebook referrals?

Here are some of the Facebook referrals that you should consider combining:

  • m.facebook.com
  • mobile.facebook.com
  • l.facebook.com
  • lm.facebook.com
  • web.facebook.com
  • touch.facebook.com

Here’s the step-by-step guide on how to combine them all:

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

How to Fix m/lm/l.facebook.com in Google Analytics: Step 1: admin google analytics

2. Navigate to filters under the “View” column.

How to Fix m/lm/l.facebook.com in Google Analytics: Step 2: google analytics filters facebook

3. Create a new filter by clicking the “+Add Filter” button.

How to Fix m/lm/l.facebook.com in Google Analytics: STep 3: add filter 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 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 an administrator access to your account.

4. Configure a new filter in Google Analytics.

Here’s how your filter settings should look like:

1) Choose the right method: “Create new Filter”
2) Give it a name (make sure you remember the purpose of this filter later)
3) Filter Type: Custom
4) Filter Subtype: Search and Replace
5) Filter Field: Campaign Source

How to Fix m/lm/l.facebook.com in Google Analytics: Step 4: configure filter in google analytics

5. Fill in the “Search String” and “Replace String” fields.

1) Search String: ^.*facebook\.com$
2) Replace String: facebook.com

How to Fix m/lm/l.facebook.com in Google Analytics: Step 5: search and replace filter

P.S. You can also combine only specific Facebook referrals as well if you want. For example, if you only want to combine lm.facebook.com, l.facebook.com and facebook.com sources together, you can use these strings:

1) Search String: ^(lm|l).facebook.com$
2) Replace String: facebook.com

If you’d like to dive even deeper, you should read more about regular expressions for Google Analytics.

6. If you’d like to see how it works, click the verify button.

How to Fix m/lm/l.facebook.com in Google Analytics: Step 6: Filter verification

This verification system shows you which sources will be combined and how the source will look like in your reports in the future if you apply it.

P.S. Google Analytics filters do not work retroactively on past data already collected in a View. Filters will start working only from the moment they are created and they are not going to change your historical data. You can use segments or table filters in Google Analytics to combine historical data.

7. If you’ve verified that the filter works properly, click the “Save” button.
How to Fix m/lm/l.facebook.com in Google Analytics: Step 7: Save

That’s it. 🙏Image Source

Final Thoughts

We hope this article will save you both time and tons of potential headaches in the future so you don’t have to struggle with those messy Facebook referrals anymore.

Here’s some additional reading on the subject written by Google Analytics specialists:

Feel free to share this guide with your friends as well who might be struggling with the same problem. If you have any questions about the topic, please post them in the comments section below.👇

Menu
123 Shares
Share
Share
Pocket
Buffer
Tweet