Although Facebook reports have come on a long way, I still find they only go so far in answering questions about how my Facebook traffic is actually interacting with my website, and crucially, how that traffic is performing compared to my other marketing channels. To bridge that gap I’ll usually use Google Analytics to measure the performance of my campaigns. In this post I’ll take you through how I tend to setup Facebook Ads with Google Analytics and how I use those Analytics reports to measure and optimise my FB Ads.
Why Use Google Analytics With Facebook Ads
I’ll pretty much always setup Google Analytics alongside a Facebook Ads campaign, even if I’m not sure whether I’m going to need it or not. I’d rather have the data and not need it than need the data and not have it and there’s been plenty of times when Analytics has answered questions about my campaigns that Facebook reports haven’t been able to. But if you still need convincing, here’s some of the big advantages off the top of my head:
- See advanced statistics on how users behave on your site after clicking through from a Facebook Ad like time on site and bounce rate
- Take advantage of enhanced ecommerce reports and shopping behaviour analysis for ecommerce campaigns
- Compare the performance of your Facebook traffic side by side with other channels like paid search or email marketing
- For publishers, linking your Analytics account with your Google Adsense account will give you more information on the ad value of your paid Facebook traffic
- If nothing else it provides a backup data source to check conversion tracking through the Facebook Pixel is working correctly and that the number of clicks you’re paying for on Facebook broadly corresponds to the number of visitors you’re getting on your website
Understanding URL Parameters
I’m going to explain a bit about URL parameters here and how and why they’re needed, if you already understand this concept feel free to skip to the tagging section.
Now just by having Google Analytics setup on your website you’re going to start seeing visitors being referred from Facebook and you’ll be able to learn a fair bit about how your Facebook traffic behaves based just on this information BUT there’s some big limitations with the data you’ll get.
You’re going to see your traffic be attributed to one of a number of different Facebook source URL’s like you see below:
And your Facebook Ads traffic will be classified as Social Referral traffic – whereas you probably want it to be classified as paid traffic.
To get around this and get the best possible integration between Facebook Ads & Google Analytics you’ll need to tag your adverts with ‘URL parameters’.
If you don’t know what a URL parameter is here’s the 2 sentence explanation…A URL parameter is an extra bit of information you can put at the end of a URL (a web address) which won’t affect the page but will provide extra information that can read by software. So for example if I was linking to http://www.johnmcelborough.com I could add a URL parameter called “animal” to the end of the URL and it wouldn’t affect the page:
http://www.johnmcelborough.com?animal=dog
Everything after the ? in the URL shouldn’t make any difference to the page itself.
In that example “animal” is the name of the URL parameter and the bit after the = is the content of that parameter, in this example “dog” is the content.
Oh and you can also string different URL parameters together using & signs so you could do something like this if you wanted:
http://www.johnmcelborough.com?animal=dog&colour=black
Make sense? Great, so lets bring it back to Google Analytics…
You’re going to use these URL parameters to send information about your Facebook campaigns to Google Analytics. Sound complicated? Its not really
Google Analytics uses 5 URL parameters:
Parameter |
Name |
Required? |
Description |
Example |
utm_source |
Campaign Source |
Yes |
The source of the traffic for this campaign, I would call it “Facebook” for any Facebook Ads campaigns. |
utm_source=facebook |
utm_medium |
Campaign Medium |
Yes |
The medium describes the types of campaign you’re running. For a Facebook Ads campaign you’ll probably call it a “cost per click” campaign so I’d use the medium “CPC” here (even if I’m not optimising for CPC in Facebook Ads. |
utm_medium=cpc |
utm_campaign |
Campaign name |
Yes |
A unique name for this particular campaign. You can put all your ads under the “Facebook Ads” campaign but I would just use same name as your Facebook campaign name here. |
utm_campaign=halfpricesale |
utm_content |
Ad content |
No |
When you’re running multiple ad variations inside each campaign you can use the utm_content parameter to distinguish between the different ads. |
utm_content=advariation1 |
utm_term |
Keyword |
No |
This parameter is designed to be used for paid search campaigns where you advertise on specific keywords, obviously with Facebook Ads you don’t have keywords so I use the utm_term paramter instead to distinguish between my different audiences. |
utm_term=lookalikes |
So with the 5 example parameters above my URL would look like this:
http://www.johnmcelborough.com/?utm_source=facebook&utm_medium=cpc&utm_campaign=halfpricesale&utm_content=advariation1&utm_term=lookalikes
That would tell Google Analytics that anyone who hit my page with those parameters had arrived from a cost per click campaign on Facebook, they’d clicked on the ad variation 1 which was in my half price sale campaign and that they were in my lookalikes audience.
Tagging Your Facebook Ads With Google Analytics Parameters
Now you understand what URL parameters are and why you need them, lets look at how you set them up in Google Analytics.
For 90% of campaigns I think the best way to tag your Facebook links with Analytics tracking will be using the URL parameters option which you’ll find in Facebook Power Editor when you build your adverts. There are examples where this might NOT be the best option though so be sure to read the measuring viral traffic section below.
You add UTM tags at the Advert level and you can do it through Power Editor or through the Advert Manager interface (I’d recommend Power Editor). Under each advert you’ll have a tracking section near the bottom of the advert editing screen, you’re looking for the URL Parameters box (don’t mis it up with the “view tags” box above):
Here’s that full example tracking which you can copy and paste if you like, just make sure you change the campaign, content and term parameters to something meaningful for your ad:
utm_source=facebook&utm_medium=cpc&utm_campaign=halfpricesale&utm_content=advariation1&utm_term=lookalikes
You can also use the Facebook URL builder tool to help you string together your UTM tags. But be warned if you’re going to use this tool its a bit misleading. It will give you a full URL at the end including the website URL which you enter. You definitely don’t want to copy the full URL into the URL parameters box in power editor. Only ever copy the parameters themselves, starting with “utm_source”. Also you don’t need to include the question mark (?) in the URL parameters box, Facebook will automatically add a ? to the end of your website URL and append the URL parameters after the “?”.
Measuring Viral Facebook Traffic in Google Analytics
There’s something important to understand with the URL parameters option I’ve described in the section above and it affects how you might want tag your links.
If you use the URL parameters option in Facebook Power Editor your tags will only be applied to the links of clicks that you are paying for on Facebook. For many advertisers that might be all or the vast majority of your traffic, but for others whose ads might be shared a lot and spread virally outside of the Facebook Ads environment your UTM tags will only be added to the paid clicks, the free clicks that come from your ads being shared won’t have the Google Analytics URL parameters added to them, so in your Google Analytics reports those visits will show up as referral traffic.
This becomes an issue if you’re a publisher who uses Facebook Ads primarily as a tool to get a Facebook page post off the ground and help it to spread virally through shares, likes and comments.
The solution to this is to attach the URL Parameters to the end of the URL you are linking people to from your ad. If the ad gets shared and the URL parameters are hardcoded into the link that is being shared they won’t be removed if the ad gets clicked on by someone as a result of a share, you’ll still be able to measure that click as part of the ad campaign in Google Analytics.
You used to have to fiddle around with URL shorteners if you wanted to link in this way from page post engagement ads to avoid having a massive great URL string in your ad content but luckily now you should be able to paste an URL into the text part of the ad and Facebook will automatically crop out the URL parameters when it displays the link in the post, so it doesn’t look too messy.
Here’s how that would look in your Power Editor:
But when that link is displayed on Facebook you’ll see all the messy UTM tags are hidden behind three dots…
Updating URL Parameters in bulk
The above process is fine if you’re setting up new ads, just remember to add the URL parameters with each new ad that you setup. But there’s not yet a way to make bulk updates to existing ads if you want to add UTM tags to every ad you’ve already got running.
So to do that I use the “export as text” feature in Power Editor.
1. In Power Editor, select the ads you want to add tags to, or select everything.
2. Then click the import/ export button and select “Export Selected as Text”
3. Copy the plain text that you get in the next window and paste it into a fresh spreadsheet (Excel, OpenOffice, Google Sheets etc)
4. In the spreadsheet you should find the “URL tags” column heading right over in column DW – thats the 127th column from the left!
5. If you’re comfortable working with spreadsheets you should find it really quick to now go through each ad (each row on the sheet is a separate ad) and apply your UTM tags and/ or write a simple formula to build URL tags based on the advert name, campaign name etc.
6. Once you’ve updated yoour tags in the spreadsheet don’t touch any other columns, just copy the entire sheet and go back to Power Editor and use the Import/ Export button again, this time selecting “import adverts in bulk”:
7. And then the link to “Paste text from tab-separated document”.
8. Paste all the spreadsheet contents into the box on that screen and click “Import”
9. Don’t worry about this importing new ads, it will just update the existing ads and add the URL tags that you added in the spreadsheet.
Setting Up A Google Analytics Segment
By now we should be receiving all our Facebook Ads click data in Analytics but how do we actually use that data in a meaningful way in Google Analytics? What I tend to do is to setup Analytics custom segments to let me see reports like the one below, snapshots of what that Facebook traffic has done when its come to my site.
And the really nice thing about segments is that once you apply a segment to your Analytics you can access pretty much all the normal analytics reports but only see Facebook traffic. Or you can compare Facebook traffic side by side with another channel like Twitter traffic by applying multiple segments. In the above example I’m comparing Facebook CPC traffic with Facebook organic traffic. If you’re logged into your Google Analytics account you can use the 2 URL’s below to import these segments into your own account as a starting point:
Facebook CPC – https://analytics.google.com/analytics/web/template?uid=JW_LfaqoQde3EoPikfBetg
Facebook Organic (non-CPC) – https://analytics.google.com/analytics/web/template?uid=42_mb_txRACX0Ty4JGTiLg
Setting up basic segments like this is pretty easy. Just look for the “Add segment” button near the top of the Analytics reporting screen:
Then click the red “new segment” button to create a custom segment.
Here you can apply any combination of conditions to the segment you want to build. For a Facebook CPC segment we’d just use the “source” and “medium” we defined when tagging our Facebook Ad URL’s with UTM tags earlier as shown below:
If you want to get more advanced with your Segments here’s a good primer.
Uploading Facebook Ads Cost Data into Google Analytics
This final step is the most advanced integration between Facebook Ads and Google Analytics and we don’t always do this, but its definitely worth it if you’re heavily reliant on Google Analytics data across your business (online stores who make use of Google Analytics enhanced ecommerce reporting come to mind here).
By default Facebook and Google don’t talk to each other to share cost data. So although we can use UTM tags to tell Google Analytics that traffic has come from Facebook campaign X or ad set Y, cost data isn’t passed between the two.
But Google Analytics does have a function to upload cost data from any source, including Facebook Ads. Its just fiddly because you have to download and format CSV’s from Facebook and manually upload them into GA. Luckily though the good people at Supermetrics have come up with a tool called Supermetrics Uploader to automate and streamline this process. With a few clicks you can get Facebook cost data sent automatically every day to GA letting you report on ad costs and ROI in Analytics like this:
Here’s how its done:
1. This tool is pretty intuitive, sign up for a free 30 day trial by logging in with your Google Account here (make sure you’re using the Google Account that you use for Google Analytics)
2. Then you can follow the prompts to log into your Facebook Ads account and select the right ad account to upload from:
3. If you haven’t uploaded data before its likely you’ll get this message telling you you need to add a custom data source in GA:
4. Click that red link and you can setup the custom data source as shown below:
5. Once thats setup in GA you should be set to start sending data from Facebook to GA using Supermetrics. With the trial account you’ll only be able to upload daily cost data but if you pay for the full version you can upload your historic data as well.