How to Use Google Analytics (or Mixpanel) to Optimize Your Facebook Ads

How to Use Google Analytics (or Mixpanel) to Optimize Your Facebook Ads

How to Use Google Analytics (or Mixpanel) to Optimize Your Facebook Ads

One of the best ways to optimize your facebook ads is to use analytics tools. Leverage the power of your data (in a deep voice)!

In this case, though, more data will give us context into how we could make our Facebook ads better. We typically focused on metrics like click-through rate and conversion rate which are important.

However, we also want to know how this traffic performs against other important metrics.

If you have a web or mobile app, you’re interested in knowing if users from Facebook are successfully going through your onboarding funnel or if you’re able to retain them.

To do this, we need to track our Facebook conversions inside tools like Google Analytics, Mixpanel, or Amplitude.

Sounds useful? Let me show you how you can get this setup.

As you’re going through this guide, I want you to focus on the ROI that you want from your Facebook ads.

Why ROI? This term is broad enough that it could apply to all businesses. ROI might mean profit for you or it might mean an efficient CAC (cost to acquisition) rate (this is for you tech startups!)

This is what Noah Kagan, founder at Appsumo and Sumo Me, had to say after spending more than $3 million on Facebook ads.

“Profit is all that matters. Ignore people who claim they get some really high click through rates (also known as CTR, or the % of people that actually click their ad). CTR is a vanity metric, and what matters most is ROI. If you are not making money, stop” – Noah Kagan

This guide is divided into two sections:

  1. Web app or websites
  2. Mobile apps

The setup differs depending on what kind of app or product you have. I’ll also show you how to send data to tools like Google Analytics (for web traffic) and Mixpanel/Amplitude (for mobile apps).

How to Know if Your Facebook Traffic Is Being Tracked Properly in Google Analytics and Other Tools

Web Apps and Websites Need UTM Parameters

If you aren’t doing anything to tag your Facebook traffic or if you don’t even know what I’m talking about then this is section is for you.

There are two problems that you need to fix:

1) By default, Facebook traffic isn’t “tagged” properly inside tools like Google Analytics. It will appear as “Direct” or “Referral” when in reality, it should be classified as “cpc”.

In the screenshot below, you can see different kinds of “sources” even though they are all Facebook. This is what lack of tagging gives you.

This is how Facebook traffic looks like if you aren't tagging it properly.

This is how Facebook traffic looks like if you aren’t tagging it properly.

This makes it nearly impossible to know if this traffic is coming from Facebook pages, links shared on Facebook or paid campaigns from Facebook.

2) Without tagging, you can’t see any campaign information and you won’t be able to see the impact of individual campaigns or ads.

We simply have a large group of traffic called “facebook” but we can’t segment down into specifics.

We have traffic from Facebook Ads but we can't what campaign it came from.

We have traffic from Facebook Ads but we can’t what campaign it came from.

The solution is simple. You need to tag your Facebook Ads with UTM parameters. These are “tags” that you add to your URL and get automatically picked up by tools like Google Analytics.

A URL with UTM parameters looks like this. I bolded the parameters:

https://practicoanalytics.com/?utm_source=mailchimp&utm_medium=email&utm_campaign=spring-campaign

I’ll show you how to create these URLs in the next section. For now, just know that we will be adding these parameters to any URL that we use in our Facebook ads.

Mobile Apps Need Attribution Parameters

Mobile apps live in a special world. Users have to go through app stores e.g. Play Store or the Apple Store to download and install apps.

These stores tend to be called “black boxes” since you can’t really see where installs are coming from.

However, there’s a solution to this! We need to give these stores something called “attribution parameters” which are similar to UTM parameters if you’re familiar with those.

Without these attribution parameters, app stores will typically tag external traffic like Facebook ads as “organic”. No bueno.

The easiest way to start using attribution parameters is to include them in our deep links.

These parameters get sent to our mobile app and we can store or send them to tools like Google Analytics, Mixpanel or Amplitude.

This is how that would look like inside an analytics tool like Amplitude.

  • source is “facebook”
  • medium is “Ads”
  • subcategory is the ad name.

These attribution parameters were stored in a deep link that was then used in a Facebook ad campaign.

I’ll walk you through how to create these deep links in the next section as well!

Creating URLs with UTM Parameters for Web App and Websites

Creating URLs with UTM parameters is easy.

1. We’ll start by opening up the Campaign URL Builder from Google which looks like this:

We can use the Campaign URL builder from Google.

We can use the Campaign URL builder from Google.

2. The first thing you need to enter is the URL that you want to tag. This could be a landing page or another page on your site.

3.We then have 5 options for UTM parameters:

  • Source
  • Medium
  • Campaign
  • Term
  • Keyword

4. Source should correspond to who is sending your traffic. In this example, this would be Facebook.

5. Medium is the type of traffic. If you’re paying for Facebook ads, you could use a value like “cpc”. I recommend that you stick to the default values that Google Analytics uses for different traffic types like “email”, “affiliate”, etc.

Medium and source go together so they should fit each other logically. If you use a medium value of “social”, then I would expect the source value to be some kind of social network.

6. Campaign can simply match the campaign name that your Facebook Ads belong to.

7. Term won’t be needed in this case but this parameter is used when bidding on specific keywords e.g. Google Adwords.

8. Content is the ad name. This value would change for each ad that you have.

Once you enter your parameters, the builder will give you a link that you can copy. This will look like this:

Tada! Our new URL with UTM parameters

Tada! Our new URL with UTM parameters

9. Now that we have our new tagged URL, we now need to add it to our Facebook Ads. This part is straightforward but tedious since we will have to use a different link for each of our ads.

Why? Because we want to have different values for the “Content” parameter. If you don’t want this, then you can likely use the same link for an entire ad campaign.

Inside Facebook, go to edit a specific ad. You will notice that there’s an input box for the “Website URL” under the Destination section. It looks like this:

We can put our UTM parameters here but there's an even better place just below it.

We can put our UTM parameters here but there’s an even better place just below it.

You could add your URL with UTM parameters BUT Facebook actually included a special input for our parameters. If you scroll down just a bit, you will see this:

Facebook offers a dedicated input box just for UTM parameters.

Facebook offers a dedicated input box just for UTM parameters.

If you use the Google URL builder, you likely ended up with a website URL that looks like this:

https://practicoanalytics.com/?utm_source=mailchimp&utm_medium=email&utm_campaign=spring-campaign

Simply take the bolded part (everything after the question mark) and copy it into the “URL Parameters” input in your Facebook ad.

That’s it! You now have taken your first step to optimize your Facebook ads. I’ll show you how to look at this data inside Google Analytics in the next section.

Related: I created a short checklist that contains all these steps in one single page. You can use this document every time you launch a new campaign to ensure that you don’t miss anything. Download this free checklist by clicking here.

Creating Attribution Parameters for Mobile Apps

Mobile apps require a special setup. There are no “UTM parameters” for mobile apps but you can still create attribution parameters to track different components of your ads.
1. We’ll start by creating a deep link for our app. You can use tools like Branch.io or Appsflyer to do this. You will need to setup your app with these tools which means adding their SDK into your app. These are the instructions for Branch.io for example.

2. I’ll use Branch.io for the rest of this tutorial but the instructions are similar across other tools. Start by creating a new deep link. The first screen will look like this:

We can use tools like Branch.io to create deep links with attribution parameters.

We can use tools like Branch.io to create deep links with attribution parameters.

3. We’ll then move to configuring the options for our link. We are interested in adding “keys and values” which will become our attribution parameters.

You can use any values that you want here BUT I recommend that you use the default web values like utm_source, utm_medium, etc. This will give you consistency with your web traffic.

You can add as many attribution parameters as you want here.

You can add as many attribution parameters as you want here.

4. You will also need to setup your app to collect these attribution parameters after a user installs your app (if only it was easy as web traffic).

This means adding some code that will listen for these parameters and then send them to the appropriate analytics tool. For example, these are the instructions that your developers can follow to send this data to Google Analytics.

For tools like Mixpanel and Amplitude, you also have a similar process. Once you receive the attribution parameters, you would then set them as user attributes or send them in an event which you can call something like “attributed install”.
5. Finally, we can add our new tagged deep link to our Facebook Ads. Hooray!

This process will be straightforward and tedious because you will need to create a new deep link for each of your ads assuming you want to track individual ads. Otherwise, you can create a general link for an entire campaign.

After you open the edit screen for an ad, simply scroll down until you get to the “Creative” section and look for the “Deep Link” input:

Simply enter your new deep link which we will let you start to optimize your facebook ads.

Simply enter your new deep link which we will let you start to optimize your facebook ads.

Copy and paste your deep link and you’re done! Pat yourself on the back for a job well done.

Related: I created a short checklist that contains all these steps in one single page. You can use this document every time you launch a new campaign to ensure that you don’t miss anything. Download this free checklist by clicking here.

Viewing Your Facebook Data Inside Google Analytics (and other tools) to Optimize Your Facebook Ads

Once you implemented your UTM or mobile attribution parameters, we can start to dig into the data.

In Google Analytics, this is how you view your data:
1. Go to “Acquisition” – All Traffic and Channels.

2. Make “Source / Medium” your primary dimension (middle of the page links)

Set up your primary dimension as "source / medium" in Google Analytics.

Set up your primary dimension as “source/medium” in Google Analytics.

3. You can then dig deeper into “facebook / cpc” or whatever you used in your UTM parameters.

4. Finally, you can add a secondary dimension such as campaign or ad content.

You’ll be comparing all of this new data against a goal in Google Analytics. You can follow these instructions to create those goals.

You can also secondary dimensions like campaign or content to further segment your traffic.

You can also secondary dimensions like campaign or content to further segment your traffic.

In Amplitude and similar tools, you can use the user attributes that you set across most reports. For example, we can create a retention table just for Facebook users using the following query:

You can use the attribution parameters in queries for tools like Amplitude or Mixpanel.

You can use the attribution parameters in queries for tools like Amplitude or Mixpanel.

If you decided to send an event with your attribution parameters, you can then use this event across any reports like funnel analysis or retention tables.

Related: If you’re struggling to set up event driven analytics tools like Amplitude or Mixpanel, then I recommend that you look into creating a tracking plan. You can download the same tracking plan that I use with my own clients here.

Why Are My Facebook Conversions Different than What I See in Google Analytics and Other Tools?

Whoa. You spent all this time getting your tracking in place and you’re now seeing discrepancies in your data against your Facebook ad data.

Relax, this is normal.

Most analytics tools are 5-10% off when compared to “direct sources” so you will run into “missing” data issues (though this can be minimized with the right analytics strategy).

The team over at Stackfield had a great write up on their experience with Facebook ads and the issues they faced. They also experienced common discrepancies:

“Surprisingly, Google Analytics reported only 28.818 visits by users who were redirected from Facebook during this timeframe – i.e. 8,81 percent less. From these users, 3.786 registered on Stackfield.” – Source

Why does this happen? There’s ton of reasons. Shanelle Mullin, from Shopify, mentioned one of the most common ones below:

“But here’s the thing. Facebook tracks conversions a bit differently than most people realize, which is why it might record a conversion that Google Analytics wouldn’t. For example, Facebook gives the conversion credit to the first touchpoint while Google Analytics gives it to the last.” – Shanelle Mullin

Instead of trying to get the accuracy down to a decimal, take a different approach.

Use your third party analytics tools to look at trends and not absolute numbers. Which ads are leading to more conversions? Are Facebook users as engaged as your other users? Do they have an equal or better retention?

You can then look at Facebook for your absolute numbers. Remember that we are focused on ROI and we can use trends to optimize our facebook ads to a better ROI.

If you’re just getting started with getting this tracking plan, then you can download a short checklist that I created covering all the steps that I listed above.

You can use this checklist every time you create a new facebook campaign to ensure that you don’t forget to track an ad (or two). Missing tracking can be the difference between profitable campaigns and “money down the drain” campaigns.

You can download this free checklist here: Download Free Checklist on How to Track Facebook Ads Inside Analytics Tools

Leave a Reply

Your email address will not be published. Required fields are marked *