Track FB Ads in GA with URL Dynamic Parameters

September 2018 Update: URL Dynamic Parameters are back!

May 2018 Update: It looks like this feature has been (temporarily?) disabled by Facebook, at least for some accounts. There’s discussion online about it not working anymore, and information on these dynamic parameters has been edited out from the official documentation. The original article is still presented below for reference, but please proceed with caution.

Facebook recently updated Facebook Ads Manager with “URL Dynamic Parameters”, a function that dynamically adds campaign information to destination URLs and greatly simplifies the process of tagging Facebook Ads for Google Analytics. This post describes the new process of creating an ad in Facebook that is tagged for Google Analytics.

NEW! API CONNECTOR ADD-ON FOR GOOGLE SHEETS

Check out my new API Connector Add-on to import data from thousands of platforms (e.g. Shopify, Harvest, Mailchimp, ActiveCampaign, VWO, YouTube, etc.) directly into Google Sheets.

STEP 1: CREATE AN AD CAMPAIGN

Log into your Facebook Ad Manager account at https://www.facebook.com/ads/manage/ and create a new campaign or continue working on one saved as a draft. Fill out your ad information under the Campaign and Ad Set levels. For tracking with Google Analytics you’ll be sending traffic to your website, so choose the following settings:

Campaign marketing objective = Traffic
Ad Set traffic = Website

STEP 2: NAVIGATE TO URL PARAMETERS SECTION

Under Ad > Links > Advanced Options, there’s a section called URL Parameters. This is where to enter the new URL Dynamic Parameters.

facebook-ads-img1

STEP 3: ADD URL PARAMETERS FOR GOOGLE ANALYTICS

Facebook provides the following new dynamic parameters (documentation):

DYNAMIC PARAMETER DESCRIPTION EXAMPLE VALUES
{{site_source_name}} Shows the Facebook platform that the ad appeared on, including  Facebook, Instagram, Messenger, and Audience Network fb
ig
msg
an
{{placement}}

placement parameters are no longer supported

Shows where the ad appeared, including Facebook desktop News Feed, Facebook mobile News Feed, Facebook right column, Messenger inbox, and Instagram Feed and Instagram Stories. Facebook_Desktop_Feed
Facebook_Mobile_Feed
Facebook_Right_Column
Messenger_Home
Instagram_Feed
Instagram_Stories
{{ad.id}} Names and IDs for ad, ad set, and campaign values are based on your own ad setup details. When you create an ad, you give it a name, and an ID is automatically assigned by Facebook. These are the values that will populate the name and ID URL dynamic parameters. 1234567890123
{{adset.id}} 1234567890123
{{campaign.id}} 1234567890123
{{ad.name}} Ad 1
{{adset.name}} US – 18+
{{campaign.name}} Traffic

SUGGESTED VALUES FOR UTM TRACKING

This can vary based on your own existing tracking structure and goals, but if you’re unsure I suggest the following:

utm_medium=paidsocial
utm_source={{site_source_name}}
utm_campaign={{campaign.name}}
utm_term={{ad.id}}

So the value you would place in the URL parameters field would be

The great thing about this is you can just copy and paste it into every Facebook ad campaign, rather than creating new parameters for each campaign via (for example) the Google UTM Campaign URL builder.

CONCLUSION

Once you’ve set up your Facebook ads for tracking in Google Analytics, you can find these values in your GA marketing reports, located at Acquisition > All Traffic > Source/Medium. Use Secondary Dimensions or navigate across the Primary Dimension tabs to view the values you input for Medium (utm_medium), Source (utm_source), Campaign (utm_campaign), and Keyword (utm_term).

GOOGLE TAG MANAGER CONSULTING

Get your own tag manager! Click for information on my Google Tag Manager consulting service.

Comments:21

  1. Hi,

    So I’ve switched over some of the tracking for one of the campaigns we have running for a client on Facebook, and the information in GA is now sprayed across several source/medium variations.

    The URL parameters field reads:

    utm_source={{site_source_name}}&utm_medium=cpc&utm_campaign={{campaign.name}}&utm_content={{placement}}

    And some of the various source/medium values in GA are:

    – fb / cpc
    – ig / cpc
    – {{site_source_name}} / cpc
    – {{site_source_name}} / (not set)
    – {{ / (not set)

    What the hell?! The article seems to suggest that all of the values should be dynamically-generated without any issues. Is Facebook’s ability to dynamically-generate these UTM parameters not as robust as we thought or did I do something wrong?

    Would appreciate any sort of response/input on this. Thought this would simplify things, not complicate them.

    1. fb/cpc and ig/cpc seem legitimate; it’s showing you that your ads appeared on both Facebook (fb) and Instagram (ig). You can check what ad platforms you’re setting ads on under the Placements section in FB Ads Manager.

      {{site_source_name}} does seem to be an issue on FB’s end, where it doesn’t always reliably recognize that field as a variable. I noticed it as well during my own tests, but it wasn’t a major issue for me since it only affected a few visits on the first day of advertising, and every one of those visits came from Facebook itself (I checked the IP addresses). So my theory is that FB’s bots visit the links immediately after you set up an ad, and their bots don’t properly convert the dynamic variable into the marketing source. In any case, I didn’t see these messed up parameters after the first day — are you seeing it ongoing? And does the traffic look like bot traffic (1 page session, 100% bounce rate)?

  2. Hi, I used these display parameters for the first time myself. I dont see any mistakes in the way I have entered the UTMs. But I am seeing a similar issue as reported here – values in GA comes as {{campaign.name}} or {{adset.name}} or {{ad.name}} rather than the actual campaign, ad set or ad name. Any help here would be appreciated.

    1. It has been 6 hours since i did this and the bounce rate is around 45% with 2-3 pages/ session.. so these dont seem like facebook bots too.

      1. Thanks for the note. If possible, would you mind returning with an update if the issue persists after the first day? And does ALL your FB ad traffic show those messed up parameters, or is some coming through correctly? At this point it’s just looking like an error on FB’s side but more info will help other people know what to expect.

    2. Hi Ana,
      I’m getting the same error where {{campaign.name}} is showing as Campaign name in GA. This is even after we used FB pixel to fire on ‘Window Loaded’ in GTM. Any help with this? Thx.

      1. This article is about adding UTM tracking for GA, which is unrelated to the FB pixel, so it won’t make any difference whether you set the FB Pixel to “Window Loaded” or not. The issue you’re having seems to be an issue with the dynamic parameters — it seems FB may not be supporting them anymore.

  3. Issue still persists on day 2 – bounce rate is around 35% so again these are not bots. ALL FB traffic where we used display parameters is coming through like this

    1. Got it, thanks for the update. And I just noticed myself that Facebook’s documentation I linked in the post has been totally changed; it used to list out all the available dynamic URL parameters, but there’s now no mention of them at all. That doesn’t seem good… I’ll run some tests and update this post with any findings.

  4. Thanks Ana. Very helpful. In fact, that’s what i was wondering too – on the FB help centre, the documentation currently only talks about hardcoding the actual parameters, rather than using dynamic parameters. This might be because there are issues with dynamic URL parameters

  5. This no longer works, could you please update the article to reflect that? Very confusing for people who don’t reach the comment section.

    1. The very first paragraph of this article reads “May 2018 Update: It looks like this feature has been (temporarily?) disabled by Facebook…please proceed with caution.” Did you not see that, or do you mean it’s not clear enough?

  6. yeah, looks like dynamic variables were eliminated after the last ads update to audiences. Perhaps related.

  7. has anyone been successfully able to put their own custom UTM source in to replace the default fb, ig, etc parameters?

Leave a Reply

Your email address will not be published.