A complete guide on how to use UTM parameters and URL macros to track your Facebook (Meta) Ads - AdWhatCost Blog

GDPR, LGPD and CCPA all became synonymous with data protection and privacy on the internet. While we can probably all agree that their implementation at this point is far from perfect, they at the very least force the big tech companies to make an effort to protect and respect their users’ privacy.

On the downside, marketers and advertisers have lost a lot of visibility on the web now that tracking via cookies requires consent by the user. A simple yet effective alternative to cookie-based tracking is tracking by means of UTM parameters. UTM tracking is far less intrusive compared to their cookie-based counterparts, as the tracking is done solely via the URL.

This makes UTM parameters one of the last battalions of tracking in a world with increasingly rigorous privacy protection measures enforced on the web. This article will not only give you an introduction to UTM tracking, but also outline frequent and costly setup mistakes.

Where to find UTM parameters

An example URL with UTM parameters

You have probably seen URLs that look like in the image above. The question mark in the middle serves as a marker that separates the website address before the marker from the URL parameters - sometimes also referred to as query strings - that come after the marker. It tells the browser to open the page sitting at the website address. The URL parameters will be transported along.

Illustration of the composition of an example URL

What are URL parameters?

But isn’t this article supposed to be about UTM parameters and not URL parameters? Yes, that is true, but in order to understand UTM parameters it is important to first get a grasp as to what URL parameters are.

It is the same principle as all thumbs are fingers but not all fingers are thumbs. All UTM parameters are URL parameters but not all URL parameters are UTM parameters. In short, UTM parameters are a kind of URL parameters.

URL parameters are key-value pairs - also known as name-value pairs - that are separated by an equal sign. The key or rather the name of the URL parameter is located before the equal sign while the corresponding value comes after the equal sign, which basically functions as an assignment operator.

Illustration of the composition of a key-value pair

If the URL holds more than one URL parameter, then the URL parameter key value pairs will be separated by an ampersand (&) sign.

Illustration of the composition of multiple key-value pairs

The difference between content modifying and tracking URL parameters

There are two main types of URL parameters with content modifying parameters being the first type and tracking parameters being the second type. Content modifying parameters are as their name suggests used to store or pass information in the URL that is relevant to the displayed content. Let’s say you are buying shoes online and filtering for size 10 shoes. In that case, many websites use content modifying parameters to store the filter selection in the URL. Other common examples are search queries as well as date range selections. Due to their influence on the displayed content on the page, they are also commonly referred to as active URL parameters.

Tracking parameters are their passive counterparts, they are along for the ride and can be extracted either directly by the website owner or more commonly by integrated tracking tools such as Google Analytics or content managing systems like Shopify. UTM parameters are the most widely used subtype of tracking parameters.

Graph of URL parameter types and subtypes

So what are UTM parameters?

UTM is short for Urchin Tracking Module. As can be deduced from the name, UTM parameters were first introduced by Urchin, a web statistics analysis program that got acquired by Google in April of 2005. It is essentially a predecessor of Google Analytics.

There is a total of five UTM parameters:

  • utm_source – where the traffic came from
  • utm_medium – how the traffic got there
  • utm_campaign – name, ID or context of the advertising or marketing campaign
  • utm_term – any related search terms
  • utm_content – reference to the ad, by name and/or ID

While each UTM parameter was created with a specific purpose in mind, you can of course use them to transport any information you see fit. For example, whereas search terms are a cornerstone of Google Ads, they don’t play a role on Facebook (Meta) Ads, which is why you could repurpose the UTM term parameter for information about the ad set. If you think about it, Facebook’s interest targeting is probably the closest thing to search terms on Google Ads.

In essence, UTM parameters tell a story of a customer’s journey to your site: Where they came from, how they got there as well as what eventually motivated them to click on your ad or link.

Although there are five UTM parameters, you are by no means required to use all five of them. In some cases, it can be plenty to only use the utm_source and utm_medium parameters. In the context of ads, however, it is strongly recommended to utilize of all five UTM parameters to transport as much information as possible. Your marketing team will thank you.

What data can be tracked via UTM parameters?

Now that we know what UTM parameters are, let’s take a look at what kind of information we should transport in them. Let’s say we are running ads on Facebook. Accordingly, the source of people clicking on one of our ads would be Facebook. Since we are talking about running ads, we could put the word ads down for our utm_medium parameter, or alternative the commonly used abbreviation cpc, which is short for cost per click, so that we can always identify that the UTM parameter set belongs to an ad. As for the UTM parameters utm_campaign, utm_term, and utm_content, we would be best served to insert references to the campaign, ad set and ad, respectively. Both their ID as well as their name are sensible here.

The power of URL macros

To enter all this information manually every single time we create a new ad, sounds both taxing and tedious. Luckily enough, the creators behind Facebook Ads share our opinion. Facebook Ads has introduced so-called dynamic UTM parameters – also widely referred to as URL macros – to save us from the hassle of having to repeatedly enter the ad data to our UTM parameters by hand.

But how do URL macros work? They are essentially placeholder values. Whenever an ad click occurs, Facebook Ads scans the UTM parameters of the ad in question for URL macros and dynamically replaces them with the correlating information pertaining to said ad click. In the case of Facebook Ads, you can recognize URL macros by the two curly braces they have at both their beginning and end.

As of the writing of this article, Facebook Ads supports a total of eight URL macros:

  • {{ad.id}} - The ID of the ad in question
  • {{ad.name}} - The ad’s name at the time of its publication
  • {{adset.id}} - The ID of the ad set in question
  • {{adset.name}} - The ad set’s name at the time of its publication
  • {{campaign.id}} - The ID of the campaign in question
  • {{campaign.name}} - The campaign’s name at the time of its publication
  • {{placement}} - The ad placement resulting in the ad click (e.g., Instagram_Stories)
  • {{site_source_name}} - The Meta platform the ad click originated from (e.g., fb for Facebook)

Common pitfalls in UTM parameter setup for Facebook (Meta) Ads

To analyze your Facebook Ads performance via UTM tracking, you need to match the recorded UTM parameter data to your ads, ad sets and campaigns. This can either be done manually or with the help of ad attribution tools such as our Shopify app AdWhatCost.

Avoid name chages after publication

The most common reasons for UTM parameters not being matchable to a Facebook ad is rooted in the way Facebook configured their dynamic UTM parameters. Facebook always pulls the name of a campaign, ad set or ad of the time of their publication to replace the dynamic parameters {{campaign.name}}, {{adset.name}} and {{ad.name}}. What this means is, that if one changes the name of a campaign, ad set or ad after their publication, there will be a discrepancy between the name that is displayed on Facebook Ads and the name that is being transported via UTM.

Example illustration of why to avoid name changes of Facebook campaigns, ad sets and ads after their pubclication

Ad attribution tools can only fetch the currently displayed name of a campaign, ad set or ad via the Facebook Ads API, which means that a match cannot be created in that case. As long as changes are minor, you likely still will be able to manually find the correct correlating campaign, ad set or ad. However, if the name changes are considerable and frequent, or if the volume of similarly named campaigns, ad sets and ads is high, then manual analysis can quickly turn into a nightmare. Just in case, we always recommend refraining from changing the name of campaigns / ad sets / ads after their publication to avoid problems of this nature in the first place.

Avoid missing references to campaign, ad set and ad level

Another all too frequent reason for matchmaking difficulties is missing references to either the campaign, the ad set or the ad inside of the UTM parameters. If you, for example, only use {{campaign.name}} and {{ad.name}}, meaning only two of the three available URL macros, this means that a reference to the ad set is missing. Now if you have two or more ads with the same name in a campaign, where the ad set is the only differentiating factor, a missing reference to the ad set means, that those ads with the same name cannot be told apart by means of their UTM parameters. This in turn does not allow matching these UTM parameters to any Facebook ad.

Example illustration of the problem with a missing reference to the ad set in UTM parameters

Another frequent setup mishap is to include only a reference to the campaign level. In this case it is not possible to track the performance of the child ad sets and ads of this campaign.

Example illustration of the problem with a missing reference to both the ad set and the ad in UTM parameters

So, either make sure to include references to all three levels of your ad, meaning campaign, ad set and ad level, or simply include the ad ID to your UTM parameters, either manually or more conveniently by using Facebook’s {{ad.id}} URL macro. IDs are unique by design. This means that just by having an ad’s ID, you can find both the ad’s parent ad set and parent campaign via the search field on the Facebook’s Ads Manager, if need be.

What are suitable UTM parameter sets for Facebook Ads?

Now that we have a good idea of what UTM parameters are, and what to pay attention to during their setup, let’s look at a couple UTM parameter sets for Facebook Ads:

UTM parameter set 1 - This UTM parameter set is ideal for Facebook Ads. It features the platform the ad click originated from as well as the ad’s name and ID along with the name of its parent ad set and campaign:


UTM paraemter set 2 - Except for the utm_source parameter, this UTM parameter set is identical to the first one. The information transported via the utm_source parameter is more granular here as it transports the placement that led to the ad click rather than just the platform it originated from:


UTM parameter set 3 - This set might be worth considering if you primarily use ad attribution tools for analyzing your ads. This is because IDs are easily processible by computers and on top of that are not affected by name changes due to their constant and unique nature:


You would like to create UTM parameters yourself? Then our UTM generator might be what you are looking for. All URL macros supported by Facebook Ads are available for selection for ultimate convenience.

As for entering a value consisting of multiple words to a UTM parameter manually, it is a best practice to use minus-signs rather than a space between the words, e.g., utm_medium=facebook-ads.

But where to put the UTM paramters?

Time to finally put your UTM parameters to use and add them to your ads on Facebook. When you create/edit an ad in Facebook’s Ads Manager, head to the Tracking section and locate the suitably called URL Parameters field shown in the screenshot below. That’s the place to paste your UTM parameters.

Where to add UTM parameters on Facebook Ads

The content of the URL Parameters field will be copied along on duplication of an ad.

As for editing the UTM parameters of existing ads, please keep in mind that this can trigger an ad being resubmitted for review and in turn a restart of the learning phase.


In this blog article you have learned everything there is to know about UTM parameters. Thanks to the magical ingredient that is UTM parameters you can get accurate insights into the performance of your Facebook ads even of users who have rejected cookie-based tracking. Don’t lose any more time and start right away!