How to Use UTM Codes to Track Facebook Ads

In 2024, tracking where your traffic helps to make smarter, more informed marketing decisions. UTM codes - while they might sound like technical jargon - are actually simple and powerful tools that can help optimise ad performance. Once understood, they give you the clarity to see what’s working and what needs tweaking, especially for your Meta ads.

Let’s explore what UTM codes are, why they matter, and how to set them up to boost the performance of your Facebook ad campaigns.

What Are UTM Codes?

UTM codes are little snippets you tack onto the end of a URL to track where your traffic is coming from. Think of them like tags that help you see exactly how people land on your site. Once clicked, UTM codes send all the juicy details to your analytics tool (like Google Analytics), so you can see which campaigns are driving traffic, and which ones aren’t.

Why Use UTM Codes for Facebook Ads?


Facebook Ads Manager, while fairly limited, provides some basic ad analytics that can give you a snapshot of your ad’s performance — like reach, clicks, and impressions. However, for deeper insights into how each ad, campaign, or ad set is driving traffic and conversions, using UTM codes alongside tools like Google Analytics will give you far more detailed data.

 By adding UTM parameters to your Facebook ad URLs, you can:

  • See where your traffic comes from: Is it coming from your Facebook ads or other sources? UTM codes make it easy to pinpoint the exact platform driving your visitors.
  • Measure ad performance in GA: View data in Google Analytics or other tools to compare how your Facebook ads perform relative to other marketing efforts.
  • Track user behaviour: See what users do after clicking your Facebook ad - whether they're browsing or converting. UTM codes help you monitor bounce rate, time on site, and conversions to optimise your ads effectively.
  • Optimise your campaigns: Use all the data you've gathered to fine-tune your ad strategy. Whether it's adjusting your targeting, tweaking your ad creatives, or reallocating your budget to the best-performing campaigns, having these insights allows you to make smarter decisions.

What Are the 5 UTM Parameters?

UTM codes come with five key parameters that help you track where your traffic is coming from and how well your campaigns are performing. 

Here’s a simple breakdown:

  1. Campaign Source (utm_source)

This parameter identifies the platform that’s driving traffic to your site, like Facebook or Google. It helps you track which platform is performing best in your campaign.

Example: utm_source=facebook means the traffic came from Facebook.

  1. Campaign Medium (utm_medium)

The medium tells you how the traffic got to your site, whether through social media, paid ads, or email marketing. It’s great for grouping your traffic by the type of channel.

Example: utm_medium=social shows it’s social media traffic, while utm_medium=cpc tells you it’s from a paid ad.

  1. Campaign Name (utm_campaign)

This parameter tracks specific marketing campaigns. Whether it’s a seasonal sale or a product launch, it helps you measure the success of each individual campaign.

Example: utm_campaign=spring_sale lets you track the performance of your Spring Sale campaign.

  1. Campaign Term (utm_term) (optional)

Mainly used for paid search campaigns, this parameter tracks specific keywords or terms used in ads. It’s perfect for understanding which search terms are driving the most clicks.

Example: utm_term=running+shoes means that people clicked through to your site after searching for “running shoes”.

  1. Campaign Content (utm_content) (optional)

If you’re running multiple versions of an ad, this parameter helps you differentiate between them, making it especially useful for A/B testing. It shows you which version performs best.

Example: utm_content=image_ad_1 tells you that this traffic came from the first version of your image ad.

These parameters give you a crystal-clear view of what’s working and where you can improve, making your marketing efforts smarter and more targeted.

Comparison Between Manual and Dynamic UTM Codes

When you're tracking your marketing campaigns with UTM codes, you’ve got three ways to go about it: manual UTM code creation, dynamic UTM parameters, and automated UTM tools. Each one has its own strengths and weaknesses, depending on what kind of campaign you're running.

  1. Manual UTM Code Creation: You build the UTM codes yourself, giving you full control over the details. However, it can be a bit tedious and prone to mistakes, so it's best for smaller campaigns that require customisation.
  2. Dynamic UTM Parameters: Here, platforms like Facebook or Google do the heavy lifting by automatically generating UTM codes. It saves time and ensures consistency, but you're limited by the platform’s options. This approach shines in large-scale campaigns.
  3. Automated UTM Tools: These tools handle everything for you, from creation to management. They’re scalable and come with a bunch of advanced features, but they can be expensive and take a bit of time to get used to. Perfect for when you're juggling multiple channels and need a streamlined solution.

Here’s a comparison of the three:

How to Create UTM Codes for Facebook Ads

Facebook understands the value of tracking parameters in your ads and has simplified the process in Ads Manager.

  1. Create of Select an Ad Campaign

To start, open Ads Manager and create or select a campaign.

At the Ad level, choose an existing ad or create a new one. Then, select Sales. Afterwards, scroll down, click "Build a URL Parameter," then enter your website URL along with the parameters you'd like to track.

  1. Add Dynamic UTM Parameters to the URL

After the URL, add dynamic UTM parameters to track your Facebook ad performance. Facebook uses specific placeholders that dynamically populate values based on the user's interaction with your ad.

Here’s how it works:

{{placement}}: Automatically captures the ad placement (e.g., Facebook News Feed, Instagram Stories).

{{campaign.name}}: Captures the name of your campaign.

{{ad.id}}: Captures the unique ID of the ad.

When someone clicks on a link with UTM parameters, tools like Google Analytics can capture this information, allowing you to analyze which Facebook ads drive the most traffic and conversions. Although UTM URLs can be long, you can use a URL shortener that automatically shortens them without extra steps.

Common Dynamic UTM Parameters for Facebook

  • {{campaign.name}}: The name of your ad campaign.
  • {{adset.name}}: The name of the ad set.
  • {{ad.name}}: The name of the specific ad.
  • {{placement}}: The placement of your ad (e.g., Facebook Feed, Instagram Stories).
  • {{site_source_name}}: The platform on which the ad appeared (e.g., Facebook, Instagram).
  • {{ad.id}}: The unique ID of the ad.

  1. Review the Final URL & Publish the Ad

Once you add the dynamic parameters, your final URL will look something like this:

https://www.example.com/?utm_source=facebook&utm_medium={{placement}}&utm_campaign={{campaign.name}}&utm_content={{ad.name}}

After you’ve added the dynamic UTM parameters, continue setting up your ad as usual. You’re now ready to publish the ad and track its performance with pinpoint accuracy. Just give the final URL a quick review to make sure everything looks right, then hit publish. With your dynamic UTM parameters in place, you’ll be able to see exactly which ads are driving results and adjust your strategy as needed.

  1. Track the Data in Analytics Tools


Once your campaign is live, it’s time to track the magic happening behind the scenes. Head over to Google Analytics (or your preferred tracking tool) and watch as the UTM parameters start pulling in real-time data. You’ll get a clear view of which campaigns, ad sets, or specific ads are bringing in the traffic.

With UTM parameters dynamically filling in based on user interactions, you can dive deep into the performance details — seeing exactly what's working and where you might need to tweak your approach. It’s like having a backstage pass to your ad performance, helping you make smarter, data-driven decisions moving forward.

Best Practices for Using UTM Codes in Facebook Ads

Be Consistent with Naming Conventions: 

When naming your campaigns, sources, and mediums, be consistent. For instance, always use facebook for the source and social for the medium to maintain clarity in your reports.

Use UTM Codes for A/B Testing: 

Differentiate between versions of your ads using the utm_content parameter. This allows you to track which creative (e.g., video vs. image) performs better.

Don’t Overcomplicate the Codes: 

While UTM codes are flexible, only use the parameters that make sense for your goals. The simpler the URL, the easier it is to track and analyse.

Shorten the URL: 

UTM-tagged URLs can get long. If you're concerned about the length, you can use a URL shortening tool like Bit.ly to make the links more user-friendly.

Elevate Your Facebook Ads with MagicBrief

To truly maximise your Facebook ad campaign’s potential, consider integrating MagicBrief into your strategy. This powerful platform serves as the world's largest ad library, featuring over 10 million ads from more than 30,000 brands, offering marketers world-wide invaluable insights and inspiration for theirs creative processes.

With MagicBrief, you can efficiently track which ads your audiences best respond to, allowing you to identify winning creatives and optimise your ad performance. Our AI-powered features also streamline your workflow, helping you tag, sort, and analyse your ads effortlessly.

By combining the precise tracking capabilities of UTM codes with the MagicBrief’s creative and analytical insights, you can refine your ad strategy, keep up with industry trends, and ultimately drive better results for your campaigns. 

Sign up to MagicBrief today and take your Facebook advertising to the next level!

Access over 5m winning ads
View All Ads
Creative reporting with AI
View your scores