Find new opportunities across AI search and SEO.

AI search and SEO.

Try free for 7 days
Outperform your search competitors.
Outperform your search competitors.Search now spans Google, ChatGPT, and beyond—and Semrush gives you the SEO and AI visibility tools to stay visible everywhere:
See how AI platforms talk about you
Discover valuable topics to cover
Get AI-powered strategy suggestions
Build keyword plans with personalized insights
Identify fixes to improve technical health
Benchmark yourself against competitors
Outperform your search competitors.
10M marketing professionals have already used Semrush
Outperform your search competitors.
Outperform your search competitors.
Outperform your search competitors.

A Guide to UTM Code Parameters, Creation, & Tracking

13 min read
July 29, 2024

What Is a UTM Code?

An Urchin Tracking Module (UTM) code is a snippet of text added to the end of a URL on your website. To help you track your digital marketing campaigns and gauge their performance.

It can look like this:

img-semblog

When a UTM-coded link is clicked, it sends data to your site’s analytics software (like Google Analytics). So you can see how users who clicked the link behaved. Like whether they completed a conversion.

Once you have this information, you can analyze it to inform how you’ll optimize your marketing strategies. 

Why Should You Use UTM Codes?

UTM codes help you:

Track Referral Traffic

Using UTM code makes it easier to track where your traffic comes from. So you know which campaigns are driving clicks.

And it’s particularly useful for tracking email campaigns. Because email is one of the few traffic sources web analytics can’t accurately track. 

UTM codes also help you track referral traffic at a micro level. 

For example, say you want to create a series of Facebook posts. 

Without UTM codes, you’d likely see a report like this in your analytics:

report on Google Analytics showing analytics for a series of Facebook posts without UTM codes

This report shows you the total traffic from Facebook. But it doesn't tell you which Facebook posts brought the traffic. 

UTM codes can give you that level of insight. So you can see things like which exact posts/campaigns drive traffic. 

Like this:

report on Google Analytics showing the traffic driven by a specific campaign with a UTM code

Understand User Behavior and Customer Journeys

Adding UTM codes to your URLs lets you effectively segment your audience to track how different groups of users interact with your site. And how those users eventually turn into customers (also known as the customer journey).

Say you notice that traffic from email campaigns converts 25% higher than traffic from social media campaigns.

Knowing this, you might want to encourage your social media followers to sign up to your email list. Where you can nurture them to become buyers.

Enhanced Attribution

UTM codes help you tie a dollar figure back to your marketing campaigns. Because you’ll know exactly which campaigns and posts are driving conversions.

Say you decide to run several organic social media campaigns advertising products. 

With UTM codes, you can see how each campaign performed. Which can help you plan future campaign messaging, forecast your potential return on investment (ROI), and allocate your marketing budget more appropriately.

Perform A/B Tests

A/B tests involve testing two versions of some sort of content against one another. Which can be an effective way of learning about your audience and understanding what motivates them to buy.

Some examples of A/B tests you can perform with UTM codes include:

  • Ad copy: Test different messaging in your ads and see which one drives the most conversions
  • Calls to action (CTAs): Create CTAs that vary in directions to determine which one results in the most clicks
  • Offer types: Test the way you position your offer (i.e., a dollar discount versus a percentage off) to see which one people prefer
  • Visual content: Add hyperlinks to product images in your emails and figure out which one drives the most traffic

What Are UTM Parameters?

UTM parameters are the different text snippets that make up an entire UTM code. To convey information about where the link is placed, which campaign it’s a part of, etc. 

Each parameter identifies a different aspect of the campaign it’s associated with. And is separated by an ampersand (&).

You can see three distinct UTM parameters in the example below, beginning with “utm_source”:

UTM code on a URL with the three distinct parameters highlighted: source, medium, and campaign

And there are five standardized UTM parameters that you can typically use for your web analytics:

UTM Source Parameter

The source parameter defines the source sending the traffic. Examples of values you might use are “google” (for ads), “facebook” (for social media posts), or “monthly_newsletter” (for an email marketing campaign).

Below, this parameter is used to differentiate the components of an email campaign. So, it uses “utm_source=weekly_sale” to track a weekly sale email. 

Like this:

UTM parameter used at the end of a URL to track traffic from a weekly sale email

And if you want to track traffic from your weekly newsletter, you could use something like “utm_source=weekly_newsletter.”

UTM parameter used at the end of a URL to track traffic from a weekly newsletter

UTM Medium Parameter

The medium parameter defines the type of traffic. Like “organic” (unpaid search), “banner” ( a type of paid ad), or “email.”

For a weekly sale campaign, the UTM parameter could look like this:

UTM medium parameter highlighted at the end of a URL

The purpose of the medium parameter is to group one medium together. To monitor the entire medium’s performance at a high level. And use it as a benchmark. 

For example, say your email traffic usually converts at a rate of 8%. But you notice a specific campaign converts at only 2%. (We’ll discuss the campaign parameter next.) 

Knowing your benchmarks helps you spot specific campaigns that underperform (or perform great). So you can dig into them to improve future campaigns. 

UTM Campaign Parameter

The campaign parameter sets the name of the specific marketing campaign. Like “fall_sale” or “product_launch”.

A weekly sales email might use the date as the campaign identifier:

For example:

With this parameter you can drill down into each campaign’s performance. 

For example, say this is a weekly sale. 

Compare it to past campaigns to see whether it performed better or worse. Then, try to understand why by looking at what could have impacted this campaign. Like different copy or product images.

UTM Content Parameter

The content parameter is useful when you have several links pointing to the same landing page and you want to know which link people clicked to land there.

For example, say you’re running an influencer marketing campaign with multiple influencers. You can use each influencer’s name in the corresponding content parameter to know who sends the traffic.

Or use content parameters to run A/B tests.

For an email campaign, you could see which image results in more revenue: product shots or lifestyle shots.

To do this, you would send half of the audience an email featuring product images. But an email featuring lifestyle images to the other half. 

And use “utm_content=product_shots” and “utm_content=lifestyle_shots” to differentiate between the two versions:

UTM Term Parameter

The term parameter sets the specific keyword or phrases that sent visitors—usually only for paid search ads. And you likely wouldn’t use it for something like an email campaign. 

Take this example URL for a Google Ad. 

UTM term parameter highlighted at the end of a paid search ad's URL

The UTM term parameter is “utm_term=website_ heatmap_ tool.” Because “website heatmap tool” was likely a keyword used for the campaign. 

With term parameters, you can compare how different keywords perform for your search campaigns.

Other GA4 parameters

GA4 also recognizes a few newer parameters. The two you’re most likely to use:

  • utm_id: A campaign ID. Useful if you import cost data from ad platforms.
  • utm_source_platform: The platform that sent the traffic, like a buying platform or marketing automation tool.

For most campaigns, source, medium, and campaign are enough.

UTM code examples for common campaigns

The values you choose for utm_medium and utm_source decide which channel GA4 puts your traffic in. Use values GA4 recognizes, or your traffic lands in “Unassigned.”

Here are tagged links for common campaign types:

Campaign type

Example UTM parameters

GA4 channel

Email newsletter

?utm_source=newsletter&utm_medium=email&utm_campaign=2026_11_black_friday

Email

Organic LinkedIn post

?utm_source=linkedin&utm_medium=social&utm_campaign=q4_product_launch

Organic Social

Paid Facebook ad

?utm_source=facebook&utm_medium=paid_social&utm_campaign=q4_product_launch&utm_content=carousel_v2

Paid Social

Affiliate partner

?utm_source=partner_name&utm_medium=affiliate&utm_campaign=holiday_promo

Affiliates

SMS promotion

?utm_source=attentive&utm_medium=sms&utm_campaign=flash_sale

SMS

QR code on a printed flyer

?utm_source=flyer&utm_medium=qr&utm_campaign=store_opening

Unassigned (see note)

A few things to note:

  • Email: GA4 assigns traffic to the Email channel when the source or medium is “email,” “e-mail,” “e_mail,” or “e mail.” Variants like “mail” or “newsletter” as the medium won’t count.
  • Social: GA4 recognizes social traffic when the source matches a known social site, or the medium is “social,” “social-network,” “social-media,” “sm,” “social network,” or “social media.”
  • QR codes and offline campaigns: No default channel fits these, so they show up as Unassigned. That’s fine if you track them by campaign name. Or create a custom channel group in GA4.
  • Google Ads: Use auto-tagging instead of manual UTM codes. It passes richer data and avoids conflicts

How to Create & Use UTM Codes for Google Analytics

Let’s go over the main steps involved in creating and using UTM codes in GA4:

Generate UTM Codes

You can manually create UTM-coded URLs or use the built-in UTM feature in the Social Poster tool (part of Semrush’s Social Toolkit) to do it faster and with fewer errors.

Open Social Poster and connect your social media accounts. Then click “New post.”

"New post" on the top left of Semrush's Social Poster clicked

Draft your post and click “UTM” to set the UTM parameters for your post’s link. And click “Apply to post.”

"UTM" dropdown opened, parameters set, and "Apply to post" clicked on Social Poster

Social Poster automatically adds the UTM parameters to your post. So you can track traffic from different campaigns, mediums, and sources.

a URL on post made on Social Poster with the UTM tag at the end

This is what the link from the above example looks like:

a URL with a UTM code added at the end from Semrush's Social Poster

If you’re creating UTM codes to use in other locations, try Google’s Campaign URL Builder.

Let’s look at how to use it to generate the below URL:

First, go to the Campaign URL Builder tool.

Make sure the toggle is set to “GA4.”

Google’s Campaign URL Builder with the toggle set to "GA4"

You’ll see the available fields to fill out. (Three are required, as indicated by asterisks: “website URL,” “campaign source,” and “campaign medium.”)

In most situations, you’ll want to use the campaign name parameter as well.

page to enter website URL and campaign information like source, medium, name, term etc. on Google's Campaign URL Builder

Fill out the “website URL” field. This is the page you want visitors to land on when they click your UTM-coded link.

"website URL" field with a URL entered on Google’s Campaign URL Builder

Next, fill out the campaign source.

This is a promotional email, so you’ll enter “promotional_email.”

campaign source field with "promotional_email" entered on Google’s Campaign URL Builder

Now, enter the campaign medium.

campaign medium field with "email" entered on Google’s Campaign URL Builder

And enter the campaign name.

campaign name field with "thanksgiving_sale" entered on Google’s Campaign URL Builder

The URL builder tool automatically generates the UTM-coded link once you fill out the fields.

This is what your URL will look like with the selected UTM parameters. 

a custom generated URL on Google’s Campaign URL Builder with the copy icon highlighted

You can copy the URL with the icon to the right and use it in your promotional email.

Or use the built-in URL shortener tool to clean up your URL. 

built-in URL shortener on Google’s Campaign URL Builder with "Shorten Link" highlighted

This is useful if you’re using the link in a place where it will be visible.

Then, when your audience clicks either the full link or the shortened link, the UTM parameters will be passed to Google Analytics. So you can analyze your link’s performance.

Test UTM Codes

After creating a UTM code, you’ll want to test it to make sure it works using the “Realtime” report in GA4. 

Just know you need to clear your cookies first if you aren't visiting your site for the first time. 

This is because the report is based on user-scoped dimensions. Meaning you're still considered a single user even if you leave and then come back. 

Only after you clear your cookies will you be seen as a new user. And able to test your UTM code.

To do this, click the three-dot icon in the top right corner of your browser and click “Delete browsing data…” 

the three dot icon in the top right corner of the Chrome browser clicked and “Delete browsing data…...” selected

You’ll see a menu where you can choose which browsing data to delete. Select “Cookies and other site data” and click “Delete data.”

"Delete browsing data" page on Google Chrome with “Cookies and other site data” selected and “Delete data” clicked

Now, paste the UTM-coded URL into your browser and visit the page.

Next, open GA4 in another browser window and click “Reports.”

"Reports" on the Google Analytics menu highlighted

Now, click “Real-time.”

"Realtime overview" report on Google Analytics showing metrics like active users in the last 30 minutes, last 5 minutes, etc.

Look for the card that shows “Users by First user source.” And click the drop-down arrow.

the drop-down arrow next to “Users by First user source” clicked

Change the dimension to “First user campaign.”

“First user campaign” selected as the dimension from a drop-down on the Realtime report

If you’ve set up your campaign parameter correctly, you should see your campaign name here. If you’re the only person testing, you should see a value of “1” in the “Users” column. 

For example, if you used “utm_campaign=thanksgiving_sale,” you should see this:

"Users by First user campaign" with the "thanksgiving_sale" campaign highlighted

If you don’t see the name of your campaign after several minutes, double-check the construction of your UTM-coded link in your browser. And make sure that nothing was accidentally changed after copying it from the tool used to create it. 

View UTM Code Tracking Data

The “Traffic acquisition” report is the best place to see your UTM-tagged traffic in GA4. Here’s how to do that.

After you’ve logged in to GA4, click “Reports.”

“Reports" selected from the GA4 menu

In the “Life cycle” menu, click “Acquisition” > “Traffic acquisition.”

“Traffic acquisition" selected from the drop-down under "Acquisition"

You’ll see a report that shows the last 28 days’ worth of data by default. But you can customize the date range by clicking the date field in the top right corner and then choosing the time period you want to evaluate.

"Last 28 days Sep 6 - Oct 3, 2023" highlighted in the upper right corner of the report

The “Traffic acquisition” report shows your site’s traffic grouped at the channel level. But you can change that by clicking the small black arrow as shown below.

the black arrow next to "Session default channel group" clicked on the “Traffic acquisition” report

Then, select “Session campaign” from the list of available dimensions.

This will change the primary dimension to show all the traffic you’ve tagged using the “utm_campaign” parameter:

a table with the "Session campaign" dimension on the “Traffic acquisition” report

Now, click the blue “+” sign to the right of “Session campaign” to add a secondary dimension to your analysis.

You’ll be able to search for a secondary dimension to add to your campaign data. Begin typing “session source / medium” in the search field and click on it.

"session s" typed and "Session source / medium” selected as the secondary dimension

This will show the details for both the “utm_source” and “utm_medium” parameters.

Here’s what the report looks like now:

“Traffic acquisition” report with details of the “utm_source” and “utm_medium” parameters combined into one dimension

You can only view two dimensions simultaneously in GA4 standard reports. You’ll need to add filters to view more dimensions.

Here’s how:

Apply a filter by clicking “Add filter” at the top left of the report.

"Add filter" clicked on the top left of the “Traffic acquisition” report

On the right side of your screen, you can now create your filter conditions.

Begin typing “session medium” in the “Dimension” field. Then click “Session medium” once you see it.

To create a filter to view your email traffic, select “exactly matches” below “Match Type.” 

"Build filter" on Google Analytics with the "Match type" drop-down opened and "exactly matches" selected

Then, click into the field below “Value” and check the box next to “email”:

"Build filter" on Google Analytics with the "Value" drop-down opened and "email" selected

Finally, click the “Apply” button at the bottom.

"Build filter" on Google Analytics with dimension, match type, value entered and the "Apply" button clicked

You now have a filtered report of only your email traffic. 

How to fix common UTM tracking problems

If your UTM data looks wrong or missing, one of these issues is usually the cause.

Your campaign shows as Direct or (not set)

The UTM parameters probably didn’t reach GA4. Common causes:

  • A redirect strips the parameters before the page loads
  • The URL already has a “?” and you added a second one (use “&” to add UTM parameters instead)
  • The parameters were placed after a “#” in the URL
  • A link shortener or email platform rewrote the link

Click your live link and check that the full UTM string still appears in the browser’s address bar.

Your traffic lands in “Unassigned”

GA4 couldn’t match your source or medium to a channel. For example, using “em” or “mail” instead of “email” as the medium leaves traffic unassigned. Switch to a recognized value (see the examples table above).

The same source appears in multiple rows

UTM values are case-sensitive. If you use different cases for the same value, GA4 treats them as different values. So “Facebook” and “facebook” show as two sources. Stick to lowercase.

Email or social traffic shows up as Organic Search

GA4 assigns traffic to Organic Search when the medium exactly matches “organic,” regardless of the source. Reserve “organic” for search engines and use “email” or “social” for those channels.

Your test visit doesn’t appear in the realtime data

Check three things:

  • You’re testing in an incognito window, so GA4 counts you as a new user
  • You accepted analytics cookies in your site’s consent banner
  • An ad blocker isn’t blocking GA4

Your data shows in the real-time report but not in standard reports

Standard reports can take 24 to 48 hours to process. Check again the next day.

UTM Code Best Practices

To successfully and accurately track your campaigns, you must keep your data clean and orderly.

Stick to these guidelines, and your UTM data will be easier to manage.

Keep Track of Your UTM codes

Keep track of the UTM codes you use in a shared spreadsheet everyone on your team can access. 

Google Sheets works well for this. 

Whenever someone in your organization creates a UTM code, they can enter it in the spreadsheet to ensure the naming conventions are followed. And that codes aren’t duplicated.

Use Lowercase Letters

UTM codes are case-sensitive. Meaning that analytics tools will treat “email” and “Email” as two separate values. 

So, stick with lowercase letters for your UTM codes to keep your parameters consistent. 

Avoid UTM Codes for Internal Links

Internal links point from one page on your site to another. Don’t add UTM codes to them.

UTM parameters tell GA4 where a visitor came from. If you tag an internal link, GA4 records your own site as a campaign source. That replaces the real source (like organic search or a newsletter) in the data GA4 uses for attribution. Your reports then credit internal clicks for conversions that external campaigns actually drove.

To track clicks on internal banners or promos, use event tracking instead. Google Tag Manager or GA4’s enhanced measurement can record those clicks without touching attribution.

Use Short and Descriptive Identifiers

Concise and descriptive UTM codes make it easier to review and analyze your data.

You need enough information to identify what the UTM code is telling you. But you don’t need proper grammar or syntax. 

Harness UTM Codes to Drive Marketing Success

You’ll have more actionable data with the additional insight coming from your UTM codes.

And that extra insight gives you a deeper understanding of your customers’ journeys. So you can optimize and improve conversions.

The Social Toolkit lets you add UTM links to every post so you can easily track all your social media traffic. 

Ready to get deeper insight into your campaigns?

Try the Social Toolkit today.

This post was updated in 2024. Excerpts from the original article by Zack Duncan may remain.

Share
Share
Add Semrush as a preferred source in Google SearchTells Google to show you more from Semrush in AI, Search, and Discover.