How To Track Facebook Advertising Campaigns in Google Analytics

Twitter Facebook Linkedin Email
Facebook ads can be a powerful source of traffic for a website. But measuring and amplifying their performance is harder if they aren’t properly tracked in Google Analytics.
No worries! We’re here to help you improve your Facebook ad tracking.


Facebook Advertising and Google Analytics


How To Track Facebook Ads in Google Analytics

Here are the quick steps:

  1. Use Google’s URL builder to generate a landing page URL with tracking parameters.
  2. In the builder enter the URL of your chosen landing page where it says “Website URL”.
  3. Name “Facebook” as the “Campaign Source”.
  4. Use “ppc” or “cpm” as your Campaign medium depending on your objective (i.e clicks or impressions)
  5. Name your campaign in a way that will help distinguish it from other campaigns you may be running
  6. Create your ad in Facebook Ad Manager
  7. In Ad Manager enter the URL you generated with the URL builder, including the tracking parameters, as the landing page in the field that says “Enter URL to promote”
  8. Complete your ad, start your campaign and measure

That’s the short version. But for a step by step guide and some insights into common problems, read on.

How Campaign Tagging Works

Google does a pretty good job of explaining how they use URL parameters to identify and classify referral traffic. But essentially, 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.

Google’s Campaign URL builder is a convenient way to help you construct a tagged link to your landing page, so you never have to worry about what parameters it should have.

Step-by-step: Tagging a Facebook Ad Campaign

Here is the detailed process, with screenshots that you can use to create a Facebook ad which is correctly 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. If you haven’t already created your parameter based landing page URL at this point head over to the Google Campaign URL Builder and fill out the form to add tagging to your landing page.

As we said earlier, this is the place where you will enter your landing page URL where it says “Website URL”. Then identify “facebook” as 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. But if this were a pay-per-click campaign, I would use “ppc” instead. 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/ppc”.


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


What if Your Facebook Traffic isn’t Showing Up?

If you skipped the parameter generation, your Facebook traffic could be getting classified incorrectly in analytics. 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 May Show Up As 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.


It’s relatively easy to properly track traffic from a Facebook campaign, there are just a few extra measures that will help you get better more accurate data and avoid the misclassification of traffic.

Subscribe to us

60 Comments on “How To Track Facebook Advertising Campaigns in Google Analytics

          1. 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.

  1. 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!

    1. 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

    2. chsweb

      Part 1 of 2:
      Google Analytics data takes 12 to 36 hours to appear in the account. If you set up a Facebook campaign today, the data will not appear in GA until tomorrow. You can test the Real Time stats in GA, that is how I test my campaigns. Real Time data in GA will show you if your Facebook campaigns are working.

      Set up your campaign in Facebook, then in GA go to Real-Time (in the left column) > Content > then click “Pageviews (Last 30 min)” and look for your campaign pages in the Real-Time data table.

    3. chsweb

      Part 2 of 2:

      Getting Campaign data, from Facebook, to appear in Google Analytics is near impossible, mainly because Google Analytics (GA) categorizes your Facebook “Campaign” as a “Referral.”

      You would think that using Google’s URL Builder to construct a link, including a Campaign tag, would do the trick, but that is not the case.

      The ONLY reliable way I have found to track Facebook ad data in GA is to use my own custom link tags. Here is what I do:
      1. in my Facebook ad, in URL Parameters, enter “fbAd-A-B-C-D” where A, B, C, D are campaign, ad, version & demographics
      2. Then, in GA, I go to Behavior > Site Content > All Pages and do a filter to Incldue Page Matching RegExp fdAd
      3. I use my custom URL approach so that I can see all of the full tracking code in GA. Using Google’s URL builder results in the tracking code getting truncated in most GA data views.

      That will now show me all of the visits I have gotten to my Facebook Ad’s landing page. From this view, I can see the Page’s value and the total unique visitors. If I got 100 unique visits, and the Page’s value is $2.34, I know that the Facebook Ad has sold $234.00 worth of products (unique visits x Page value).

      So far, I have found no better way. I can then compare the GA data to the data in Facebook Ad Manager to WooCommerce or Shop, etc.

  2. 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?


    1. 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.

      1. 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?

  3. 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? API?

    1. 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.

  4. 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?

  5. 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)?

    1. 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?

    2. 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.

  6. 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.”

    1. 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

      1. 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.

      2. 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

  7. 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?

    1. 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.

  8. ditte

    we are currently having an issue with Google Analytics tracking, which I hope you might be able to help out with?
    We recently set up a campaign in the facebook business manager, containing approx. 6 different advert sets, each set with an individual UTM code so that we – in analytics – can track performance of each respective advert set by the end of the campaign.
    As the different sets will be running at different times and not overlap (last weekend = advert set 1 ran for two days, next weekend = advert set 2 will run for two days, etc.), so far only set 1 has been active. However, in Google Analytics we now experience that the active advert set has generated several thousand sessions of traffic, but ALSO that the other sets have generated between 20-60 sessions (however, these have not been activated yet).
    Everything is double checked everywhere – can anyone help with what is happening?

  9. Miloš Milosavljević

    My experience at the moment is that facebook won’t accept a very long link with utm variables, however, when you shorten it, all is well and the data gets transferred to the landing page and GA.
    I built a UTM builder and link shortener tool in Google Spreadsheets that you can check out:
    How to build manual:

    If you would like to try it out on my sheet, drop me your gmail to my LinkedIn inbox.

  10. Levmeister


    I am wondering if the order that the source, medium, campaign etc.. appear in the URL matters. I don’t see why it would but I am just trying to troubleshoot why my data isn’t appearing in Google Analytics.

    I believe I have tracked my URLs correctly but all my CPC data (utm_medium=cpc) from Facebook (utm_source=facebook) seems to be showing as (not set) in the campaigns reports. In addition this data also doesn’t seem to be showing any action in the conversions so I am unable to link a Facebook ad with a goal conversion.

    In the same campaign but using medium as social goal conversions seem to be appearing perfectly ok. It just doesn’t seem to work for cpc.

    Any tips would be much appreciated?

    I am thinking to use social instead of CPC for the medium to see if the data will show.

    Potentially there is a delay in the data so I will also wait and see if anything changes.

    1. megalytic

      Facebook seems to sometimes strip out UTM parameters without any explanation. People have reported that the problem goes away if you encode the long URL using a link shortener like or Use the shortened link for your ad. Please try that and let us know if it helps.

      1. Levmeister

        Thank you very much for the reply.

        I will try this next time I run some ads and let you know the results. Interestingly enough the data that appeared from social (utm_medium=social) was from a link and this contained all the information I was after.

  11. Sarah

    Thanks for the information! I have now set this up but now the information in facebook and google analytics doesn’t match up?? Can you help please? Thank you

    1. megalytic

      Can you be more specific? What numbers do not add up? Note that Google Analytics tracks conversions differently from Facebook. FB uses a “view through conversion” model that attributes any view of an ad as contributing to a conversion. GA, on the other hand, by default does “last visit” attribution, so will only attribute conversion to FB if the last visit to the web site before conversion came from FB (of came in directly, after having previously coming from FB).

      Let me know if that makes sense of if you need more details.

      1. Sarah

        Hi thanks for your reply.
        Apologies i’m new to this, basically on my FB adverts manager it says for example 0 link clicks for yesterday, yet Google Analytics says 7 sessions for the same day.

        1. megalytic

          A couple things could be going on.

          (1) A session is not the same as a link click. So, if 7 people clicked on the link and came to your site on Tuesday, and then those same 7 people came back directly to your site on Wednesday – you would see 7 sessions from your campaign on Wednesday, but 0 link clicks from these people. Google attributes direct visits to the last campaign that the visitor was referred by, see:

          (2) The other possibility is that your tagging is not unique. Are there other ads/campaigns elsewhere using the same Google Analytics tags? See:

  12. Kristina

    Thanks for this useful info.
    I’ve tagged my FB ad just like you’re advising. Now I see 8 conversions (product purchase) in the Ads Manager reporting and 0 transactions from this campaign in GA. Such discrepancies don’t seem normal to me. But as far as I understand, this is all about attribution, right?

    1. markdhansen

      Purchases are tracked differently by FB (using the Facebook Pixel) vs GA (using Ecommerce Tracking: One or the other might be configured incorrectly.

      Alternatively, FB reports “view through conversions”. So, FB will attribute a campaign if the user viewed that campaign, and didn’t necessary click, before making a purchase. GA will only attribute the FB campaign is the user clicked through from the campaign on FB.

  13. Mark Tsui

    hello, i pasted the url in facebook ad, but when i saw the landing page report in google analytics, the landing page url has a long tail, “utm-source=facebook&utm-medium=cpc&utm-campaign=brand”, a short dash? The url is right in my ad. I don’t know what’s wrong. Who can help me?

      1. Ole Shved

        That’s happened due to the short dashes used in the parameters’ names (i.e. utm-source), but for them to be recognized by GA as parameters’ names the underscore [ _ ] should be used (e.g. utm_source) instead.

    1. markdhansen

      In theory, yes. And many people do use shorteners. However, there are persistent discussions about problems with this. For example, see:

      Personally, I do *not* use shorteners with FB ads that click through to our company website. I like to have the domain of the link by my company domain. And Facebook allows a long enough character limit to make shortening unnecessary.

      For more discussion on this, see:

    1. markdhansen

      You use either (1) or (2) – not both. If you want to use different URL parameters for the same website URL in different ads, then use (2). In the simpler case, as described in this blog post, where all ads will be tagged the same, you can use (1).

Leave a Reply