Threads scheduling has arrived on Buffer! Find your community now. Learn More
Buffer Marketing Library Content Marketing

The Complete Guide to UTM Codes: How to Track Every Link and All the Traffic From Social Media

Jeffrey Kranz
Jeffrey Kranz Team Buffer
The Complete Guide to UTM Codes: How to Track Every Link and All the Traffic From Social Media

10 min read
You will learn

Quick: which social network is bringing in the most traffic to your website right now?

It’s OK if you don’t know off the top of your head. (I don’t memorize that sort of stuff either!) But wouldn’t it be great if you could pull up the answer in just a few seconds whenever your boss asks you this?

What about revenue broken down by social network? What about the percentage of traffic generated by social versus email?

You can track it all, and you can track it for free: all you need are an analytics tool (like Google Analytics, Hotjar, or Mixpanel) and UTM codes.

Here’s everything you need to know about the magic of UTM codes and how I use them in my own digital marketing work.

Looking for a simple way to create your own UTMs for an upcoming marketing campaign? Try Buffer's free online UTM builder — there are no limits, and it'll stay 100 percent free, always.

A simple overview of UTM codes

Here's a lightweight beginner's guide to the world of UTM tracking links.

What are UTM codes?

UTM stands for “Urchin tracking module.” Google acquired Urchin Software Corporation in 2005, and their software laid the groundwork for what we now know as Google Analytics.

UTM codes are snippets of text you can add to the end of a URL that tell Google Analytics (and other analytics tools) a little bit more information about each link.

Here’s a sample of what one looks like:

utm code example

Why are UTMs important?

As a social media manager, content creator, or small business owner, you’re likely sharing scores of links across several social channels as part of your digital marketing efforts every month.

Yes, Google Analytics, Mixpanel, and the like can give you a general, high-level idea of your top traffic sources. But what about when you want to get specific?

UTM links help you track the performance of each of those links so you can see exactly where your traffic is coming from.

You can use the UTM parameters — the short tags within the UTM link, which we'll discuss below — to track big-picture info, like how much traffic you’re getting from certain social media platforms.

You can use them to track the details, too, like how much revenue you get from an ad campaign, the competing performance of a new call to action (CTA), or how much traction you get from a creator you’ve worked with as part of an influencer marketing campaign.

There are many, many ways to track clicks with UTM links. The key to accurately analyzing your social media marketing efforts with UTM codes is consistency

If you create a template for your tracking parameters and stick to it, you’ll save yourself a lot of time (and headaches!) in the future.

I’m about to share an approach to UTM tagging that has been especially helpful for me when it comes to measuring the success of my links. I hope it will be for you, too!

But before we jump into that, let’s quickly set our expectations for what a well-tagged URL can accomplish for you.

3 essential questions UTM tracking can answer

When all UTM’ed up, a link should be able to help you answer some basic questions about your website traffic:

  1. Where is the traffic coming from?
  2. How is it getting to me?
  3. Why is it coming to me?

Essentially, UTM tracking codes tell the story of how your traffic is coming to you.

This works by using several elements called UTM parameters, which we’ll cover in detail below. The essential ones are:

  • Source
  • Medium
  • Campaign

That’s why a UTM-tagged URL looks like this:

See all those “utm_” bits? That’s where we’re labeling the traffic that comes from this link.

Of course, typing that long string of characters is pretty scary, so most people use UTM generators. These nifty tools let you plug in the values for each of those parameters, and then the tools do the magic of stringing them together into a nice URL. Some popular generators include:

The UTM parameters, in turn, tell Google Analytics (or whatever tool you use) how to sort your incoming website traffic. If you’re tracking your links across social media (and across the rest of your digital content), you’ll be able to really drill down on which content is performing best and where.

It’s worth noting that there are several optional tags you can use in your UTM tracking, along with source, medium, and campaign:

  • Campaign term (to help you track paid search keywords if you’re running search ads)
  • Campaign content (for multiple links to the same landing page — good for things like A/B testing two different banners)
  • New tags with Google Analytics 4 (GA4): utm_id: (for a specific campaign, which is necessary in GA4 for importing some data from Google Ads.) and utm_source_platform: (to pinpoint the platform directing traffic to a given Analytics property).

It’s worth getting to grips with the three required UTM tags before you start to use these additional parameters. The good news, though, is that once you have the hang of source, medium, and campaign, adding in the others will be a breeze.

Let’s look at how to use UTM codes and parameters in your social media links.

With UTM codes, we’re trying to help Google Analytics and other tools tell us the story of how our social media traffic is getting to us. We’re trying to answer three questions:

  1. Where’s the traffic coming from?
  2. How is it coming to me?
  3. Why is it coming to me?

The good news? Choosing your UTM parameters is as simple as answering those questions for every link you publish. Let’s look at how that works together.

utm examples for social media links

1. How to use the ‘source’ UTM parameter in social media

You can use the name of the social platform you’re sharing the link to (e.g., LinkedIn, Facebook) as the source UTM tag.

The source parameter is about answering the question: “Where is my traffic coming from?”

By adding the parameter &utm_source= to your links, you’re tagging every visit that comes from that link in a way that says, “This visit came from X.”

So, your source UTM parameter will simply state where the traffic is coming from.

Now, I say “simply,” but there are many ways to do this. For example, if you were tweeting to your followers about a great blog post you just wrote, you could answer the question “Where is the traffic going to come from?” a few ways.

  • It’s coming from you, the sharer.
  • It’s coming from X (Twitter), where it’s being shared.
  • It’s coming from your followers, the ones reading it.

There are all kinds of ways you could think about this.

But Google recommends using the “source” field to describe the “referrer” or the entity sending the traffic your way. In this example, a good source tag would be simply “LinkedIn.” There are a few good reasons for this:

  • You will eventually want to track ALL of your traffic from LinkedIn in one place
  • In the case of social media links, this makes even more sense. If someone shares or reposts your links, the traffic isn’t really coming from you anymore — but it’s still coming from the same social media platform.

In social media, I’ve found the most straightforward approach is to use the social platform you’re sharing the link to as the source UTM tag. When I share a link to Facebook, it is tagged with “&utm_source=facebook”.

2. How to use the ‘medium’ UTM parameter in social media

Consider setting “social” as your medium tag for all links shared on social media.

This parameter is all about answering the question: “How is my traffic coming to me?”

By adding the parameter &utm_medium= to your links, you’re tagging every visit that comes from that link in a way that says, “This visit came via Y.”

This is a little less straightforward than the source tag we looked at because, for every way to describe where the traffic is coming from, there are probably ten ways to explain how it’s getting to you.

That’s why it can be helpful to establish some UTM conventions up front. If you give yourself a general list of options for the medium tag, then this part of the link-tracking process can be a lot easier.

Google suggests using a general name of the marketing medium for this parameter on their Campaign URL Builder, like “cpc”, “banner”, or “email”.

That helps keep things straightforward. For tagging UTM codes on social media, a straightforward approach is to always use “social” as your medium. You don’t have to do this, but I’ve found it makes it very easy to sort the traffic in my high-level marketing channels — especially if I’m taking Google’s advice on this when I’m tagging other links.

Just FYI, here are some other medium tags you might consider for non-social links:

  • “Email” for email marketing campaigns or email newsletters
  • “Blog” for your content marketing resources
  • Blog-guest (for when you’re guest posting on an influencer’s blog)
  • Blog-syndicated (for when you’re sharing your articles with syndication sites)

3. How to use the ‘campaign’ UTM parameter in social media

Now for the last of the questions: “Why is the traffic coming to you?”

This is what the campaign UTM parameter is all about. By adding the parameter &utm_campaign= to your links, you’re tagging every visit that comes from that link in a way that says, “This traffic is coming from This.”

There are so many ways to use this tag. The beauty is that if you’re consistent with the naming conventions for your source and medium UTM parameters, you have a lot of flexibility when it comes to tracking campaigns.

Here are a few ways to think of using the campaign parameter:

  • Use it for special promotions. Doing a new product launch? Try “launch-[Product Name]” as your campaign name.
  • Use it for personas. If a post is crafted especially for one buyer persona, consider tagging that link accordingly. For example, you could try “manager-mandy” or “practitioner-pam” as your campaign values.
  • Use it for business objectives. Is that blog post you’re tweeting about going to generate leads, sales, or thought leadership? You might try using campaign values like “contact,” “complete,” or “lead.”

UTM links are case-sensitive, so if you’re inconsistent in your naming conventions, you will get inaccurate data about your link performance. For example, using both ‘instagram’ and ‘Instagram’ as your source in one campaign will mean your metrics are off. 

To be safe, stick to lowercase letters across the board — things can get messy very quickly if you throw variables like capital letters into the mix.

On that note, steer clear of symbols, too. Adding extra ‘?’ and ‘&’s, in particular, might break your UTM links.  

Another thing worth noting: your audience can see your tracking links in their browser when your page loads. Don’t use any words in your tracking parameters you’d rather they didn’t see. 

Case Study: Using UTM parameters to tell the story of Star Wars

Remember the end of Star Wars, when Luke Skywalker and the Rebel Alliance race to blow up the Death Star before the evil Galactic Empire destroys the rebel base?

What if we told that story… with UTM tags?

Luke Skywalker is flying to the Death Star. Let’s assume Luke represents web traffic coming from a tagged link. We’ll make the target URL the rebels are sending “traffic” to.

The source of that traffic? That would be the Rebel Base. If we were to express that in UTM terms, we’d have…


So we know that the Death Star is where Luke Skywalker (the traffic) is flying to, and we know the source of that traffic (Rebel Base). Now… how’s Luke getting there? In his trusty X-wing fighter, that’s how!

Now, what if we added that to our UTM story? It would look a little something like this:


So we know that Luke Skywalker (the traffic) is flying to the Death Star (the destination URL). He’s flying from the rebel base (the source) in his trusty X-wing fighter (the medium).

But why? Why is that traffic coming to the Death Star in the first place?

Because the Rebels want to save their base and later save the galaxy from the likes of Darth Vader.

So, if we were to sum up this story in UTM tags, we would need a campaign tag to tie this all together. We’ll choose “stop-darth-vader” for this one. 


So, here’s the story of Star Wars in UTM-tagged URL form:

  • Destination URL = where the traffic’s going (the Death Star)
  • Source UTM tag = where the traffic’s coming from (the rebel base)
  • Medium UTM tag = how the traffic’s getting there (X-wing fighters)
  • Campaign UTM tag = why the traffic’s going there (to stop Darth Vader)

Happy UTM tracking

Let’s do a super-quick recap of what we’ve covered:

  • The source UTM tag = the referrer (Facebook, Twitter, LinkedIn, YouTube, etc.)
  • The medium UTM tag = how the traffic gets to you (for most social media links, this will just be “social”)
  • The campaign UTM tag = why the traffic is coming to you (launch, persona, promotion, etc.)
As a reminder, Buffer's free online UTM builder is super simple and completely free to use.

I hope you’ve found this article (and my very well-thought-out Star Wars case study) helpful!

Brought to you by

Did you find this article helpful? You might also like our all-you-need social media toolkit.

Get started for free now
On this page
Try Buffer for free
Brought to you by

The all-you-need social media toolkit

140,000+ small businesses like yours use Buffer to build their brand on social media every month

Sign up for free