How To Track Facebook Advertising Campaigns in Google Analytics

Twitter Facebook Linkedin Email

Did you ever run an ad on Facebook and feel like Google Analytics wasn’t reporting the traffic? Did you notice a jump in your direct traffic instead? Here’s why and what you can do to make sure Google Analytics properly tracks traffic from your Facebook ads.

Facebook Advertising and Google Analytics

Where’s My Facebook Traffic?

A client of mine recently ran some Facebook ads and was perplexed that there was no big bump in their referral traffic from Facebook. Here’s a screenshot showing a typical day during the campaign.


Referral traffic from Facebook shows up as (mobile), (desktop) and (link shim traffic from FB). The 24 sessions shown here were much less than expected.

Facebook Traffic Often Shows up at Direct

However, this client was seeing a big bump in their direct traffic. A typical day would have 10-15 direct, but here they were seeing 123. The problem was that Google Analytics was classifying a lot of the Facebook advertising traffic as direct.

In Google Analytics, direct traffic is traffic for which a referrer wasn’t specified. GA gets the referral information from the HTTP header. However, if the HTTP header does not include a referrer field, then GA cannot figure out where the request is coming from.

For many reasons, traffic from Facebook ads often do not include a referrer, and that causes GA to classify the traffic as direct. So, in order to accurately classify traffic coming from Facebook, you need to take a different approach.

Campaign Tagging

You need to tag your Facebook campaigns. Campaign tagging means adding parameters to the end of your landing page URL to identify the source. Google describes it here. When a Facebook user clicks on a link that has been tagged in this way, those parameters are detected by Google Analytics and used to correctly classify the traffic as coming from Facebook.

How do you know what parameters to use for tagging? Luckily, Google provides a convenient URL builder to help you construct a tagged link to your landing page.

Step-by-step: Tagging a Facebook Ad Campaign

Here are the steps you can use to create a Facebook ad that is tagged for tracking in Google Analytics. First, open your Facebook Ads Manager and click Create Ad as you normally would.

Start creating the Facebook ad

For this example, let’s assume that you want to optimize for clicks to your website. So, select that option from Facebook.

Select the option to generate clicks to website

Now, Facebook asks you to enter the URL of the landing page where ad clicks should send the visitor. At this point, head over to the Google URL builder and fill out the form provided to add tagging to your landing page.

Enter your landing page URL where it says “Website URL”. Use “facebook” for the “Campaign Source”. In this case, I’m using “cpm” as the “Campaign Medium” because Facebook is going to charge me for impressions, not just clicks. If this were a pay-per-click campaign, I would use “cpc”. Lastly, give your campaign a name where it says “Campaign Name”.

How to fill in the form for the Google URL builder

When you click “Submit”, Google will give you an enhanced landing page URL with the parameters properly added for accurate classification by Google Analytics.

Google URL builder returns the tagged landing page URL

This is the URL that you enter into the Facebook ad builder when prompted to “Enter URL to promote”.

Enter the tagged URL when prompted by Facebook

Now, complete the creation of your Facebook ad as you normally would. Start the campaign, and observe what happens in Google Analytics.

Facebook Advertising Traffic – Properly Classified

After a few hours, check your Google Analytics. You should start seeing traffic from Facebook classified as “facebook/cpm” or “facebook/cpc”.

Facebook advertising traffic showing up correctly

Now, if you click through on the “facebook/cpm” row in Google Analytics, you can see the campaign information that you entered in the Google URL builder. Make sure that you select “Campaign” as the Primary Dimension in the Google Analytics report. This will show you the name of your campaign. As you can see below, it shows clicks coming from the “Clicks to Website 1” campaign – which is what we entered into the Google URL builder.

Viewing your Facebook campaign name in Google Analytics

Subscribe to us

  • chris_chringle



    +1, grazie

  • Alessio

    If i’ve many campaign how can i automation this?

    • markdhansen

      Alessio – what is it you want to automate? The tagging of the campaign URLs?

      • Alessio

        Yes, i’d like traking my facebook ads campaign without create every single link

        • markdhansen

          Many of the tools that Facebook advertisers use for automation can auto-tag for Google Analytics. I’m not an expert on these tools, so I cannot recommend any one in particular. Suggest you do a Google search on something like “automatically add google analytics tags to facebook advertising” – which turned up this one for me:

          • Alessio


          • chsweb

            There are a few Google Sheet templates that can help with this – search for Google Sheet URL Builder. A better way is to use a Text Expansion App, like aText ($5 in Mac App Store) to create a few snippets. For example, I use aText to automate bullet proof buttons in HTML Emails and Google URLs.

            I type “glink” and aText pops open a form where I simply enter the parameters.

            For example, this link:
            “” was made in seconds with aText, right here in the comment – see attacked screenshot.

  • Lee

    I am currently running a Facebook Ad using the
    Clicks to Website Objective. I have followed all of the instructions when
    building out a custom landing page URL with the correct parameters.

    My FB Analytics are recording website clicks where as in Google Analytics under
    campaigns I am seeing no results. The campaign is not even listed. Any insight
    would be extremely helpful. I can not seem to figure out what I am doing wrong,
    that Google Analytics would not be receiving any data at all.

    Thank you in advance for your help!

    • markdhansen

      Hi Lee,

      Check that the landing page where the FB ad is sending traffic, has Google Analytics tracking installed and operating correctly. Google Tag Assistant can help with this (

      If it seems like GA is installed, then, try clicking on the URL you used to create the Website Objective. Check that it is sending you to the correct landing page. Do this a few times, and check that data from your own clicks is showing up in GA.

      If data from your own clicks is showing up, but FB clicks are not showing up, then FB might be doing something to the URL parameters (stripping them out). I’ve heard about this happening, but I have never experienced it. You can prevent that by shortening the URL with or something similar, and using the shortened URL as your Website Objective.

      Good luck!

      — Mark

  • Qiao Watson

    Can GA track the revenue of Facebook Mobile News Feed Ads?
    I’ll run Android mobile ads on Facebook, I’m wondering if GA can track the ads data?
    Or do i need to use a third-party tool for tracking ads revenue?


    • markdhansen

      Where is the revenue generated? If the revenue is earned by a checkout on the website, then you can use Google Analytics Ecommerce Tracking.

      • Cathy Eglington

        I don’t always see my conversions in analytics (e-commerce revenue tracking) I think it’s due to last click takes all credit. if the user navigates around the page after booking i can’t see revenue. is there a way around this?

        • markdhansen

          If Ecommerc is set up correctly, you should see all the transactions, but maybe the attribution is not what you want, because of last-click default attribution. I suggest you take a look at Google Analytics attribution modeling, so you can try to achieve what you need:

  • Claytonseo

    Hey man, thanks for the article, how do you get CPC and Impression data from FB Ads? I can only read that one must use the Google Dev Import functions, importing data sets via a customized ga:properties. No other way? Automated way?

    • markdhansen

      There is an API for FB Ads. However, I doubt that Google is going to make it super easy to import this data into Analytics, because they are competitors with FB.

      Megalytic ( is planning to integrate FB Ads via the API later this year. That will help with what you need.

  • SpaceTimeMedia

    We tag everything using URL builder, as well as an adserver tag.Although we see campaign referral traffic in GA attributed to Facebook, we still have anywhere between a 10% to 30% drop out in stats reported by Facebook and GA. And we still see an unhealthy spike in direct traffic during a campaign period. So to me in indicates that GA url builder is not fit for purpose when tracking paid for media of any variety be it Facebook or another ad network?

    • Mark Hansen

      How do you know that there is a 10-30% drop off? If you are seeing a drop-off, my guess is that it is because the query parameters are getting stripped off of the URL at some point.

  • Mazza

    Hello Mark, it seems that I am loosing the parameters when my FB traffic comes from the FB APP. I am showing a lot of traffic for but the medium, campaign and content are getting lost.

    Any tips on how to bring all the utm even when traffic comes form (app)?

    • chsweb

      Mazza, Have you tried creating the tagged link and then shrinking it in or before entering it into your Facebook Ad or Facebook post?

    • markdhansen

      If you are tagging as described here, you shouldn’t be losing any parameters. Keep in mind, that if other people are sharing your content on FB, then they probably are not tagging it – so you will be getting traffic from that does not have any campaign or content UTM values.

    • Alexander Ernst

      Hey Mazza– I’ve been reading up on this and it seems that the solution is to use the link without tags, and then add all those tags in the “URL Tags” section. It’s available in the Power Editor in the ad settings.

  • chsweb

    For the folks who are tagging their link with Google’s URL Builder, but not seeing the data come into Google Analytics from Facebook, check out this page:

    Looks like you have to use the Power Editor to enter a tagged URL, the UTM tracking porting going in it’s own input field within the Ad Creation process:

    “First, in Facebook, just add the domain and then add the UTM codes after you create your ads. But there’s a catch. This can only be done in Power Editor. To do this, open Power Editor, select the ad, and then scroll down to the “Tracking Section,” where you’ll see the empty box beneath “URL Tags.” Paste the UTM code there.”

    • Luc Henri

      thanks for posting this chsweb! reading the comments section on this it looked like there was some confusion as to whether the tag should read “?utm_source…” or “utm_source”. do you know if the “?” is required? thanks in advance for your help, much appreciated

      • chsweb

        99.9% sure the ? is required at the beginning. In doing some testing, I found that the Facebook Ad link did not without the leading ? for the Google Analytics tracking code.

      • chsweb

        After running a few campaigns, I can confirm that putting “?utm_source…” in Ad Manager’s URL tag input results in the referring URL appearing as “??utm_source=facebook…” in Google Analytics.

        It still works fine and tracks correctly in Google Analytics. I am almost certain that when I entered the URL in Facebook WITHOUT the leading “?” that the Ads link did not work.

        I recommend including the leading ‘?’ to make sure it works. Test on your end and report back here. I am documenting this for the Multi-Channel Marketing Ad section of COMPOSE at

    • chsweb

      Make sure the “URL Tags” begins with ?

      In the screenshot above, it should be ?utm_source=facebook…

  • sumrando

    Hi, I’m getting m.facebook AND mobile.facebook showing up. What’s the difference?

  • Rob Banks

    So adding the GA UTM through the URL Parameters (optional) box at the ad level should help eliminate discrepancies between HTTPS and HTTP from clicks that come from in-app? Also, should you leave the UTM code on the URL in the ad URL or just put it in the URL Parameters (Optional) box at the ad level?

    • chsweb

      Put the Google URL parameters in the optional box. If you put them in the Ad’s URL, they get lost.

      Even if you put it in the optional box, I still only see the campaign tracking show up in the referrals, not in campaigns.