How to Create UTM Codes to Track Your URLs in WordPress

How to Create UTM Codes to Track Your URLs in WordPressDo you want to use UTM codes to track your URLs in WordPress? UTM codes help you track the performance of your marketing campaigns.

Knowing the channels your users access your website from can help you improve your marketing strategies.

In this guide, we will show you how to use UTM codes in WordPress to track your URLs. Before we begin, here is a brief introduction to UTM codes and why you should use them for your marketing campaigns.


What are UTM Codes?

UTM is short for Urchin Tracking Module. They are snippets of code that track link performance across different mediums.

The UTM parameters do not change the link destination. Instead, it appends a tracking code that can track traffic sources, as seen in the image below.

UTM codes parameter

UTM codes consist of two components; UTM Parameter and Tracking Variable. The UTM parameter starts with the keyword ‘UTM’ followed by an underscore and the name of the parameter you want to track.

There are five parameters you can track with UTM codes:

  • Source (utm_source)
  • Medium (utm_medium)
  • Campaign (utm_campaign)
  • Term (utm_term)
  • Content (utm_content)

Tracking variable is a unique identifier for the parameter you intend to track – such as the traffic source. It comes after the “=” symbol in the UTM code. To name the variable, you can use only letters, numbers, underscore, a hyphen, and a plus sign.

UTM code typically starts with the ‘?’ symbol appended at the end of the link you wish to track. After that, you will find the UTM parameters stacked next to each other, separated with the ‘&’ symbol.

A link can contain just one parameter or all five of them, depending on how you create the UTM code. Below is a UTM code example.

Note that adding UTM parameters to a link does not affect the destination. This means you can remove the parameters, and the link will load just fine.

How Are They Useful?

The main reason for using UTM codes on your website is to give your analytics tools information about your traffic sources.

It is a handy tool for digital marketers and web developers. Knowing your main traffic sources, you can dedicate more resources to promoting content on those sites.

For example, if you are running a Facebook ad campaign, you can use the URL above for your ads from Facebook. And when you get traffic from those ads, you can easily tell that the source is Facebook.

What Can You Track With UTM Codes?

There are five parameters that you can track with each marketing campaign. Three of the five parameters are mostly used by digital experts (campaign, source, and medium). But you may choose to use all five parameters for more insights.

We will explain what each tracking parameter does here.

Source (utm_source)

This parameter tracks the origin of your website traffic. The parameter also allows you to track sources from Google, Facebook, Bing, Twitter, or your email list.

Example: utm_source=facebook

Medium (utm_medium)

The medium parameter tracks the general channel your visitors are coming from. For example, traffics coming from Facebook and Twitter can be grouped under social traffic. Other examples include referral traffic, direct traffic, paid media traffic, etc.

Example: utm_medium=social_media

Campaign (utm_campaign)

The campaign parameter lets you track the performance of a specific campaign. So if you run multiple promotions through social media and email marketing, this parameter can tell you which promotion is performing well.

Example: utm_campaign=spring_sales_fb or utm_campaign=spring_sales_ppc

Keyword Term (utm_term)

This parameter is used to identify keywords in a paid campaign. For instance, if you pay for google ads to rank for the keyword “WordPress support”, you can add the term parameter to the link before you submit it to google.

Example: utm_term=wordpress+support

Content (utm_content)

This parameter tracks specific types of content with the same destination and shares a common medium and source. So if you have multiple links that point to the same URL, this parameter will track the exact link that was clicked. You can also use this parameter for A/B testing two links that point to the same URL.

Example: utm_content=sticky_header or utm_content=sidebar

Creating UTM Codes to Track your URLs in WordPress

Here, we will show two ways to create UTM codes for your website. The first method involves installing a marketing plugin on your website. You can, likewise, use the online tool method if you don’t want to install a plugin.

Using MonsterInsights Plugin

MonsterInsights is an all-in-one content marketing tool for WordPress websites. This tool is robust and integrates well with Google Analytics.

You can easily connect your WordPress site with your Google Analytics account. Best of all, you can use the plugin to generate UTM codes for URLs on your website.

To start, you need to install and activate the plugin on your website. But if you already have the plugin installed on your website, you can skip to the section for creating UTM codes.

For this, login to your admin dashboard and then go to Plugins >> Add New. Type the keyword “monster” on the search box and then click Install Now next to the MonsterInsights plugin.

Download MonsterInsights plugin

After the installation completes, the button changes to “Activate”. Click on it to activate the plugin. It will redirect you to the plugin’s settings page.

You need to run the setup wizard to connect your site to Google Analytics. For this, click on Connect MonsterInsights and Setup Website Analytics.

Run the setup wizard

Select your website type on the “Setup Wizard” page, and click Save and Continue.

Select website type and save

Next, click on Connect MonsterInsights to link your website with Google Analytics.

Click on Connect MonsterInsights

After that, select the account associated with your Google Analytics. However, if you have not set up Google Analytics, follow this link to learn how to create an account.

Select account with Google analytics

Now, you need to select a property from your Google Analytics account.

Select property from Google account

After connecting your website with Google Analytics, click on Complete Connection. You can then follow the remaining steps to complete this setup process. Once done, proceed to create the UTM codes for your website.

Creating UTM Codes to Track URLs

To use the UTM code feature, go to Insights >> Tools. On the ‘URL Builder’ tab, you will see a form where you can enter the UTM parameters.

Go to 'URL Builder' tab

Enter your website address or the link for which you wish to generate a UTM code. After that, fill in other UTM parameters, as seen in the image below.

Fill in the parameters to generate utm code

After filling in the values, scroll down to the “URL To Use” section, and you will see the UTM code the plugin generates for you. Click on Copy to Clipboard to copy the UTM tracking URL.

Copy UTM tracking URL to clipboard

You can follow the same procedure to create more UTM tracking codes for the links on your website.

The UTM link can be used to run promotions across various mediums. After some days, it will generate reports for you in your MonsterInsights dashboard.

With this plugin, you can also create an unlimited number of UTM codes for all the links on your website.

Using Google’s UTM Builder

If you do not want to install a plugin to create UTM codes, you have an alternative. There is a tracking URL builder you can use for this purpose.

First, we recommend you connect your website with Google Analytics so you can track the performance of your links. You can follow this link to our guide on how to set up Google Analytics in WordPress.

After connecting your website with Google Analytics, you can proceed to create the UTM codes using the Campaign URL Builder tool.

On the “Campaign URL Builder” page, you need to fill out a form with information about your business.

Campaign URL Builder to create utm codes

The campaign source, campaign name, and campaign medium parameters are compulsory. Therefore you need to enter a value for these parameters before the tool can generate your tracking link.

The campaign term and campaign content values are optional. But if you need to track those values, then you should fill them in the form.

generate utm codes using campaign url builder

You can copy the UTM link it generates and use it for your website campaigns. Though if you want to shorten the link, you can click the Shorten Link button. A new window will then appear, asking you to sign in or register with You can simply connect it with your google account.

Shorten the link

Upon completing the signup process, it will generate a short UTM link for the URL you just created.

Generate short UTM code link 

How to Track UTM Codes in Google Analytics

To track the UTM codes you create for your website, you can use Google Analytics. Even without creating UTM codes, Google Analytics can still track (to some extent) where your traffic originates.

To use this tool, log in to your Google Analytics dashboard. Once in, go to Acquisition >> All Traffic and click on Source/Medium.

Google analytics dashboard

Here, you will see all the traffic sources from which your visitors access your website.

Traffic sources from your website

You can also click on an individual traffic source to find more information about it.

Individual traffic source

The data may be sufficient for small websites. But if you run marketing campaigns through newsletters or google ads campaigns, it would be helpful to know the links users clicked that led them to your website.

This is where UTM codes can be beneficial. For instance, you may have 2 CTA (call to action) links with UTM codes for the same email promotion. One link may lead to your landing page, while the other leads to your homepage.

The utm_content parameter can tell the exact words users clicked before accessing your website.

After creating the UTM codes, you can track their performance from your Google Analytics dashboard. Go to Acquisition >> Campaigns >> All Campaigns to open the UTM tracking page. You will see all the UTM codes you have created for your website.

Open UTM tracking page

In the image below, you will find the black_friday campaign we created earlier in this guide with Google’s URL builder. Clicking on it will show additional information about this campaign.

Click on campaign created for additional information

From here, you can track the number of users that access your links and the channels they come from.

UTM Tracking Codes Best Practice

Before creating a UTM code for your website, there are a couple of tips to keep in mind.

1. Naming Convention

You need to decide the format for naming your parameters. All team members should adhere to this convention if you run a marketing agency.

It is common for users who do not outline their marketing parameters to have duplicate data in their analytics tool. A practical example is using ‘social-media’ and ‘social_media’ to track UTM mediums.

Although both parameters look similar, they are, in fact, different. One uses an underscore, while the other uses a hyphen symbol.

This would result in you having multiple data for your social media UTM campaigns. This can be confusing when analyzing the data.

You and your team should specify the naming convention before creating UTM codes. As a result, it will ensure that related data are grouped.

2. Easy to Understand Names

Your campaigns should also use easy-to-understand names so anyone can easily understand the marketing goal from the UTM code.

Take a look at the UTM code below.

Looking at the UTM code, you can tell it is a Facebook promotion for a 20% discount offer.

As opposed to using random strings and numbers for the UTM parameters.

It can be confusing to analyze the data because the parameters are not descriptive.


To sum up, UTM codes help keep track of the links you promote on your website. You can share UTM links through different channels, such as an email newsletter, paid search, or sharing blog posts on social media.

This guide explains what UTM codes are. It also shows how they can be helpful to website owners. In addition, we showed you how to create UTM codes to track your URLs in WordPress.

Google has a data studio that can help you represent your analytics data in a responsive dashboard. It is a handy tool for social media marketing. Follow this link to learn more about Google Data Studio.

 This post was written by Mesheal Fegor

Mesheal Fegor is a Web/WordPress Developer and technical writer. His WordPress help articles have been featured on Kinsta and other sites. Mesheal holds a master's degree in computer science. His writing focuses on technical WordPress issues, ranging from core WordPress problems, to issues with WooCommerce, and more.

Last edited by: FixRunner Team