You’re Tagging Facebook Ads the Wrong Way and It’s Costing You Critical Data. Here’s How to Fix It

Let’s be honest. Tagging URLs isn’t rocket science. You just plug some values into Google’s URL Builder and you’re good to go, right? And yeah, for the newbie that’s good enough.

But…

As a serious digital marketer, you know that data is the foundation of making good decisions. You know that you need good data. You need accurate, correct, and complete data. You now that one tiny error in tracking can render your data completely useless, or worse lead you to incorrect conclusions and bad decisions with potentially catastrophic results.

So, yeah, to a newbie, tagging URLs is just something you dash off. But for a pro like you, tagging your Facebook URLs requires skill and attention.

Through this course you will become a master of tagging Facebook URLs and bridge the gap between Facebook Ads reporting and Google Analytics. You’re about to learn:

  • The three most costly mistakes when tracking Facebook Ads traffic with Google Analytics
  • The no-brainer tagging solution that virtually eliminates human error
  • The counter-intuitive way to prevent sending bad data to Google Analytics
  • The secret, hidden UTM parameter that Google doesn’t want you to know about (and why it’s the key to unlocking your Facebook Ads data in Google Analytics)
  • The ultimate copy-and-paste set of parameters for tagging Facebook ads
  • How to match up your Facebook Ads campaign data (like clicks, impressions, and cost) to Your Google Analytics data (like sessions and goal completions)… and have it always be up-to-date!

The 3 Most Costly Mistakes When Tracking Facebook Ads Traffic with Google Analytics

These three mistakes are so innocent. In fact, 99% of digital marketers out there believe they’re doing the right thing, completely unaware that these “standard” practices are doomed to produce bad data.

Sending Static Tracking Parameters

If you’ve ever tagged a URL with utm_ parameters, you’ve no doubt used the Campaign URL Builder. The advantage of this form is that the names of the parameters are pretty much guaranteed to be correct. Just to give you an example, I’ve caught myself forgetting to add the utm_ part of a parameter name or two!

The pitfall of using the URL Builder is that the parameter values are still entered manually. This opens the door to a couple of opportunities for errors.

Typographical errors such as misspellings

One misspelled word could undermine efforts to match up Facebook Ads reporting data with data from Google Analytics.

Mismatches between names in Facebook and the values of your utm_ parameters

In order for Facebook Ads reporting data to jive with Google Analytics, the names of campaigns and ads have to match exactly. Even the slightest difference (e.g. “Holiday Sale Event” vs. “Holiday Sales Event”) can throw the whole thing off.

Setting Text Values

Sending text through URLs can cause all sorts of mayhem. Characters and even spaces can be interpreted in a variety of ways (e.g. “Holday%20Sales%20Event” vs. “Holiday+Sales+Event”).

Campaign Name in Facebook Ads Manager
Notice the square brackets
Campaign Name in Google Analytics
The [square brackets] became &#x23x5b;

Using Only Standard UTM Parameters

Should you use the standard set of UTM parameters? Definitely! Use them all, if you can. However, there’s one critical UTM parameter that’s completely missing from the standard set. And this one secret parameter, which you’ll discover later, is the linchpin that brings all your Analytics and Facebook data together.

The No-Brainer Tagging Solution that Virtually Eliminates Human Error

Facebook has its own campaign URL parameter builder similar to Google’s, but with one key difference. Facebook lets you insert dynamic parameters.

Dynamic parameters are basically variables that Facebook will replace on the fly, plugging in the value of whatever element you select.

For example, suppose you have two Facebook campaigns, one named “Holiday Sale Event” and another name “Hot Summer Sale”. If you tagged your ads with utm_campaign={{campaign.name}}, the first campaign would end up being tagged with utm_campaign=Holiday Sales Event while the second would be tagged with utm_campaign=Hot Summer Sale.

The are a couple big advantages to using dynamic parameters:

  1. You don’t have to worry about setting the value correctly. Facebook takes care of it automatically.
  2. You could set up a universal set of parameters and save the string of parameters somewhere (e.g. a notepad file). Then, whenever you create a new Facebook ad, just copy and paste your string of dynamic parameters.

The Counter-Intuitive Way to Prevent Sending Bad Data from Facebook to Google Analytics

When tagging Facebook ads, it’s tempting to use {{campaign.name}} for utm_campaign, {{ad.name}} for utm_content, etc. But if you’re a sophisticated digital marketer who is serious about tracking and analyzing your campaign’s performance, you resist this temptation. Instead, you opt for something that, to the untrained, will seem absurd.

Instead of recognizable “names” (e.g. campaign name, ad name, etc.), you opt for the numeric IDs.

You might be thinking, “But how am I going to know what campaign or ad I’m looking at in Google Analytics?”

Excellent question! And the answer is… You won’t. You won’t be able to easily recognize what you’re looking at in Google Analytics.

But, as we’ll see later, you’re not limited to viewing this data inside Google Analytics. 😉

There are two major benefits to using IDs instead of names.

Firstly, numbers aren’t prone to the same “transcription errors” that we saw earlier with text values (e.g. [brackets] becoming a string of odd characters).

Second, Facebook has a quirky feature that makes using names very unreliable.

Name-based parameters, like ad.name, will be set to the campaign, ad set or ad name used when the ad was first published. Campaign, ad set or ad names can still be changed, but the parameters will refer to the original names. This means that URL parameter values that contain campaign, ad set, or ad names can’t be changed during the lifetime of that campaign, ad set, or ad once it has been published.

https://www.facebook.com/business/help/1016122818401732

This can pose a serious challenge when a name has changed and you want to match up your Facebook Ads reporting data with your Google Analytics data. Why? Because Facebook will always report the current name. But Google Analytics will always receive the original name.

However… the ID will never change. Ad ID “23844229530770213” will always be ad ID “23844229530770213” no matter how many times you change the name of the ad.

The Secret, Hidden UTM Parameter that Google Doesn’t Want You to Know About (and Why It’s the Key to Unlocking Your Facebook Ads Data in Google Analytics)

OK. It’s best to use IDs rather than text. Got it. But does that mean we should set the utm_campaign parameter to the Facebook campaign ID, then?

If you dig deep enough into the dimensions and metrics explorer, you’ll discover a dimension called Campaign Code. This dimension represents the ID of a given campaign. It’s the equivalent of the Google Ads campaign ID dimension, but for non-Google campaigns. In other words, this “Campaign Code” dimension is specifically designated to store campaign IDs in Analytics.

You can see this dimension in the main user interface by going to Acquisition > Campaigns > All Campaigns and looking in the secondary dimension list.

But how the heck do you set it? Is there some secret UTM parameter that Google decided to leave out of the set of familiar parameters we all know and love?

Actually… Yes. There is a secret UTM parameter. And that parameter is:

utm_id

So, to set the “Campaign Code” dimension to the ID of your Facebook campaign, add the “utm_id” parameter to your string of parameters and set its value to {{campaign.id}}.

utm_id={{campaign.id}}

The Ultimate Copy-and-Paste Set of Parameters for Tagging Facebook Ads

So, how do I tag my Facebook campaigns? Here you go! This string of tags uses exclusively dynamic parameters. All of the parameters are IDs except utm_campaign. I set the utm_campaign parameter to the name of the Facebook campaign. Why? Because I use the utm_id parameter to pass the Facebook campaign ID and store it in the Campaign Code dimension.

When we need to match up Facebook reporting data with Google Analytics data, we can match up Facebook Campaign ID to Google Analytics Campaign Code. Since we don’t have to match the Analytics “Campaign” dimension to anything, we’re free use the utm_campaign parameter (which, of course, sets the value of the “Campaign” dimension) to whatever we want. Naturally, we want the campaign name!

OK. Enough blah, blah, blah. Here you go.

utm_source={{site_source_name}}&utm_medium=social&utm_campaign={{campaign.name}}&utm_content={{ad.id}}&utm_id={{campaign.id}}

Bonus: How to Match Up Facebook Ads Data With Google Analytics Data Using Google Sheets

By using dynamic parameters and passing IDs (including the Facebook campaign ID), we’ve got good data in Analytics that can be joined easily and reliably to data from Facebook. Now the question is… how do we join the two data sets?

Install a Google Sheets API-Connector Add-On

The service I use is Supermetics. Supermetrics has the most API connectors of any service for Google Sheets. It also lets you schedule data refreshes as often as hourly and send dynamic email messages with attached data sets (as CSVs, PDFs, etc). If you’ve got the means, use Supermetics.

However, for this example, I’ll use a free service to demonstrate.

Create a new sheet in Google Sheets. Click on “Add-ons”. Then click “Get add-ons”.

Install the Adveronix add-on.

Get the Data

Launch the Adveronix add-on.

Select the Facebook connector. You’ll go through the usual app authorization process. You know the routine.

Configure your report by selecting your desired dimensions (Adveronix refers to dimensions as “breakdown”) and metrics.

Be sure to include Campaign ID and Ad ID. You’ll probably also want Day in there, as well. But Campaign ID and Ad ID are critical because you’ll definitely be needing those in order to join your Facebook data with your Google Analytics data.

Before you pull any data, make sure you’ve selected cell A1 in your sheet. By default, whichever cell is selected will be the top-left-most cell of your table of data.

Once you’ve got your connector configured, click “Get Data”.

Create a new sheet (within the same spreadsheet). Launch the Adveronix add-on again. This time, select the Google Analytics connector.

Once again, you’ll have to go through the usual authorization process. Then, configure the connector with the desired dimensions and metrics.

Be sure to include the Campaign Code and Ad Content dimensions. You’ll need those to match up your stuff from Google Analytics with your stuff from Facebook Ads.

And, again, I’m guessing you’ll probably want the Date in there, too.

Make sure you’ve selected the same date range for Google Analytics as you selected for Facebook Ads.

When you’re ready, click “Get Data”.

Join the Data

To see a live example of the end result of this process, click here.

We’re going to be doing a VLOOKUP. And for this example, we want to lookup each unique combination of date, campaign ID, and ad ID. So, we’re going to create a “key” comprised of those three dimensions, concatenated.

On the Google Analytics sheet, in the first row of the first empty column, type the word “key” as a header for the column.

Next, in the second row of your “key” column, enter a formula to concatenate the date, campaign code, and ad content. (Also, because Adveronix returns the date from Google Analytics in the format yyyymmdd, we have to a little fancy footwork to get Google Sheets to interpret the date correctly.)

=FILTER(DATEVALUE(LEFT(google_analytics!A2:A,4)&"-"&REGEXEXTRACT(TO_TEXT(google_analytics!A2:A),"^[0-9]{4}([0-9]{2})")&"-"&RIGHT(google_analytics!A2:A,2))&B2:B&C2:C,A2:A>0)

Now, on our Facebook sheet, let’s use VLOOKUP to look up the sessions and users from our Google Analytics data.

For our VLOOKUP to work, the first parameter needs to match the structure of our Google Analytics key. So, we start by concatenating the Day, Campaign ID, and Ad ID columns.

=VLOOKUP(A2:A&E2:E&I2:I

The second parameter of our VLOOKUP will be the range of cells from the Google Analytics sheet.

It’s important to note that VLOOKUP searches for matching values in the first column of the specified range. But our “key” (which is what we need to match) is not the first column. In order for VLOOKUP to work, our key needs to be the first column in our selected range.

To solve this problem, we’ll use a little trick I wrote about here which uses QUERY to put the columns in whatever order we’d like.

=VLOOKUP(A2:A&E2:E&I2:I, QUERY(google_analytics!A:F,"SELECT F, D, E")

The third parameter of VLOOKUP represents the desired column index or, in our case, indices. We want both the “Sessions” and “Users” columns. And because we’re going to wrap this whole formula in a FILTER function, we can specify an {array} of column indices to get both columns in one shot.

Remember that our QUERY selects only 3 columns: the “key” column, the “Sessions” column, and the “Users” column. So, the indices for the “Sessions” column, and the “Users” column are 2 and 3 respectively.

=VLOOKUP(A2:A&E2:E&I2:I, QUERY(google_analytics!A:F,"SELECT F, D, E"), {2,3}

We’ll finish up our VLOOKUP function, setting the fourth parameter to FALSE (because we want exact matches only).

=VLOOKUP(A2:A&E2:E&I2:I, QUERY(google_analytics!A:F,"SELECT F, D, E"), {2,3}

Finally, let’s wrap the whole thing in a FILTER (to apply the formula to all rows with data) and an IFERROR just to prevent the unsightly #N/A, should there be any weirdness anywhere with our data.

=IFERROR(FILTER(VLOOKUP(A2:A&E2:E&I2:I, QUERY(google_analytics!A:F,"SELECT F, D, E"), {2,3}, FALSE), A2:A<>""))

And there you have it. You’ve masterfully tagged your Facebook ads and demonstrated some serious Google Sheets prowess joining your data from Facebook with your corresponding data from Google Analytics. Congratulations! You should celebrate.

2 thoughts on “You’re Tagging Facebook Ads the Wrong Way and It’s Costing You Critical Data. Here’s How to Fix It”

  1. Hey,

    so that means whenever I use a dynamic template and change adset/campaign/ad -names later, in GA4 it will ALWAYS show up as the parameter I set when first published? Wow that sucks…

    Reply

Leave a Reply to magi Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.