What is Campaign Tracking?

Campaign Tracking is a feature which enables you to log marketing campaign details when linking to your website online. This can help you track the exact impact of your marketing campaigns. It reveals things like, how much traffic they are bringing in, how engaged those visitors are, and whether the campaign is resulting in sales or not.

The Value of Campaign Tracking

If you are new to analytics, you might wonder why you need campaign tracking links at all. After all, Matomo already tracks the websites and search engines that refer traffic to your site. However, this standard type of referral tracking doesn’t work for all traffic types. Emails are one common example where it is not possible to automatically tell where a visitor has come from and the visit will show as a “Direct entry”. In cases like this, setting up email campaign tracking URLs ensures you know how visitors reach your site when it matters.

One other benefit of campaign tracking URLs is you can configure them to tell you exactly which email, button or link a user came from. You can set different campaign names for each email and each link to tell them apart.

Of course, email marketing is only one situation where you can use campaign tracking. Campaign tracking URLs are commonly used to get enhanced tracking data from the following sources:

  • Pay-Per-Click (PPC) Adverts – Which campaigns and keywords are driving revenue?
  • Display and Banner Adverts – Which platforms and specific banners are driving traffic?
  • Third-Party Marketplaces – Which external listings refer people back to your website?
  • Social Networks – Which social media posts are getting the most traction?
  • Email Newsletters – Which newsletter campaigns are driving traffic and sales?
  • Guest Blog Posts – Which external content attracts the most website visitors?
  • And many more!

With campaign tracking, each traffic source or different link on the same page can have its own unique tracking values. The more specific you are with your use of campaign tracking links, the better quality data you will receive. When reviewing your campaign reports in Matomo, you can compare the statistics from each campaign and focus your marketing efforts on the campaigns that are working well.

The Anatomy of a Matomo Campaign Tracking URL

As previously mentioned, campaign data is tracked through the use of URL parameters. In the example below, you can see a standard URL and a campaign tracking URL with a campaign tracking parameter attached:

  • Standard URL:
    https://example.com/

  • Campaign Tracked URL:
    https://example.com/?mtm_campaign=newsletter_cyber_monday

The bold part at the end of the second URL is an example of the mtm_campaign campaign tracking parameter in use. Both of the links above go to the same web page; however, the second link tells the website which campaign it came from. In this case, the value is set to the newsletter_cyber_monday campaign.

Although there is only one campaign parameter in the example above, it is worth noting that there are two parameters available within Matomo by default and a total of eight parameters for even more detail if you are using Matomo Cloud or the Marketing Campaigns Reporting plugin.

The full set of eight campaign tracking parameters allow you to add even more context to your links and are recommended. Below you will find a list of the complete set of campaign tracking parameters, along with a short description of the values you would attach for each.

Default Campaign Tracking Values

  • Campaign (Required): mtm_campaign
    A descriptive name for the campaign, e.g. a blog post title or email campaign name.

  • Keyword (Recommended): mtm_keyword
    The specific keyword that someone searched for, or category of interest.

Additional Campaign Tracking Values

(Available with Matomo Cloud or Marketing Campaigns Reporting Plugin)

  • Source (Recommended): mtm_source
    The actual source of the traffic, e.g. newsletter, twitter, ebay, etc.

  • Medium (Recommended): mtm_medium
    The type of marketing channel, e.g. email, social, paid, etc.

  • Content (Optional): mtm_content
    This is a specific link or content that somebody clicked. e.g. banner, big-green-button

  • ID (Optional): mtm_cid
    A unique identifier for your specific ad. This parameter is often used with the numeric IDs automatically generated by advertising platforms.

  • Group (Requires Matomo 4 or above): mtm_group
    The audience your campaign is targeting e.g. customers, retargeting, etc
    Note: Requires Matomo 4 or above.

  • Placement (Requires Matomo 4 or above): mtm_placement
    The placement on an advertising network e.g. newsfeed, sidebar, home-banner, etc.
    Note: Requires Matomo 4 or above.

Hopefully this has given you a general idea of what is possible. You will find some examples of each of these campaign elements further down this page within the common campaign tracking use cases.

Exercise: Get Started With Campaign Tracking

If you have not used campaigns before, we highly recommend you start using campaigns. As an exercise, send an email newsletter and use the campaign URL builder described below to generate a campaign link for all your links. Then look at the campaign reports to measure the impact the newsletter had on the traffic to your website and your business objectives. If you don’t send email newsletters, try to include the campaign links within your support emails or in your social media shares. You can find a list of common use cases further down the page.

How to Build Campaign Tracking URLs

As Campaign Tracking URLs are created by appending parameters to the end of a URL, it is technically possible to create tracking links manually by typing them out. However, the easiest way to create campaign tracking URLs is with one of the official URL builders. You can use the Matomo URL Builder on the Matomo website.Or, if you are logged into your analytics, there is a Campaign URL Builder tool built directly into Matomo. The process for using the built-in tool can be found below.

How to Generate Campaign Tracking URLs with the Matomo Campaign URL Builder

  1. Log in to your Matomo instance and click on the Acquisition section.
  2. Click on Campaign URL Builder sub-menu item.
  3. Copy the URL from your website that you would like to create a tracked link for.
  4. Paste the copied link into the Page URL (Required) field.
  5. Add any required and desired campaign values in the remaining fields. In the grey box alongside each field, there is a description of what it should include, along with examples.
    Matomo Campaign URL Builder
  6. Click the big green Generate URL button at the bottom of the page.
  7. Copy the generated URL from the grey box below and use it wherever you are running your campaign, for example, in an email or a third-party marketplace.

Generated Campaign URL

Important Note: You have to actually use the tracked URL in your campaigns for it to be useful. Generating the link alone does nothing as campaign links are only useful when people actively click on them. Therefore you need to embed the tracked URL within your digital marketing campaigns.

Selecting Appropriate Campaign Values

While you can type almost anything as values for each of the campaign tracking elements, you will want to plan ahead to ensure they are useful. In general, you want to make sure that you use descriptive human-readable values so you will be able to easily identify them when reviewing your analytics.

There are a few considerations which may not be immediately apparent.

  • Campaign values are stored in lowercase – For consistency, don’t use capital letters when creating your campaign tracking values.

  • Special characters may not work – If you want to use special characters such as a forward slash in your value, you will need to encode it for use within a URL. As an example, to include a forward slash in your campaign values, it would need to be typed as %2F within your URL. Click here for a URL encoding tool.

  • Don’t use spaces – This is also related to URL encoding. The space character will often break links. Many people choose to use underscores or dashes to represent spaces instead. Although, you can also encode spaces for URL usage by typing %20. For example, if you were creating a tracked link for a “brand awareness” campaign, you might use:

    • brand%20awareness – Displayed as brand awareness in your analytics
    • brand_awareness – Displayed as brand_awareness in your analytics
    • brand-awareness – Displayed as brand-awareness in your analytics

Whatever method you choose, it is important to be consistent, otherwise, you will find your traffic split between multiple variations of the same campaign, which can make accurate reporting harder.

  • Campaign tracking values are visible – One final consideration is that all of the campaign values are visible to the end-user. This may seem obvious, but it also means that people may notice the values when visiting your website. Make sure you choose values that you are happy for the public to see and avoid including any personal data or personally identifiable information (PII) within your URLs.

You may not want to use the following URL, for example:
https://example.com/?mtm_campaign=secret_list&utm_source=private_supplier&utm_content=john_smith

Common Campaign Tracking Use Cases and Examples

Below you will find a few examples of how you can use the campaign tracking features with various marketing campaigns. Each contains a short description of why you might use it, along with best practices and an example. You should only use as many campaign values as you need, so not every example below contains every parameter.

How to Track Email Marketing Campaigns

Clicks from emails are treated as direct visits by default, so campaign tracking links add useful context to clicks from this channel. The example below confirms the source of the traffic (newsletter), the medium (email) and reports on the specific email (2020_august_promo), and even tracks which single button was clicked within that campaign (primary-cta).

When the time comes to review the data, you could look at all of the campaigns from your newsletter source to compare their success. Or you could compare the content value to see which links within your emails were most successful.

Example Campaign Values

  • mtm_campaign: 2020_august_promo
  • mtm_source: newsletter
  • mtm_medium: email
  • mtm_content: primary-cta

Campaign URL Based on Above Example

https://example.com/?mtm_campaign=2020_august_promo&mtm_source=newsletter&mtm_medium=email&mtm_content=primary-cta

Tracking Campaigns on Third-Party Websites

Perhaps you are selling products on a third party auction website, or selling services through an online job board. In either case, you probably will not be able to add your own analytics code to the platform directly, but you can use tracked links to ensure that data is passed onto you when people click over to visit your website.

This use case is especially useful when you have to pay for placements on the third party websites. Gathering data on exactly which listings and elements people visit from, means you can focus your budget on the most effective placements.

Example Campaign Values

  • mtm_campaign: product_launch
  • mtm_source: marketplace
  • mtm_medium: display
  • mtm_content: banner

Campaign URL Based on Above Example

https://example.com/?mtm_campaign=product_launch&mtm_source=&mtm_medium=display&mtm_content=banner

Not only are there many different social networks, but there are different types of content within these networks. When linking to your site from social networks, you can use campaign tracking URLs to analyse the performance of the individual networks and content types.

Using Twitter as an example, you could track the different types of link with the mtm_content parameter. For example, you could add mtm_content=profile for the link contained in your user bio, mtm_content=tweet for your regular status updates, and mtm_content=paid for any sponsored placements on the network.

Example Campaign Values

  • mtm_campaign: product-launch
  • mtm_source: twitter
  • mtm_medium: social
  • mtm_content: tweet

Campaign URL Based on Above Example

https://example.com/?mtm_campaign=product-launch&mtm_source=twitter&mtm_medium=social&mtm_content=tweet

How to track Cost Per Click (CPC) Campaigns with Google Ads

Using campaign tracking links within Google Ads (and other ad networks) is an interesting use case because you can use dynamic values in place of your campaign values. This means you just have to put in one placeholder and the advertising network will automatically put in the relevant details for each ad that you run. You can view an example of this advanced configuration for Google Ads here.

Disadvantages of Campaign Tracking URLs

There are many benefits to campaign tracking URLs, but there are a few potential drawbacks you should consider.

Hard to Type

Campaign tracked URLs are perfect for digital campaigns as users only have to click on them for them to work. However, they don’t work so well for print campaigns as the final URLs are usually too complex for users to type in manually. Some potential solutions for this are link shortening services like YOURLS.org or you can use a QR Code that people can scan with their mobile device.

Long URLs

Longer tracking URLs can also cause challenges in the digital world. For instance, when you have a limited number of characters available for a social media post or text message, you don’t want to use most of them with a long tracking URL. Again, a potential solution here is to use a link shortening service like YOURLS.org.

Potentially Inaccurate

When campaign tracking links are shared, it can lead to inaccurate reporting. For example, sending an email with the following link to your email marketing newsletters makes sense:

https://example.com/?mtm_campaign=customer_newsletter&mtm_medium=email

However, if one of your subscribers copies and pastes the link to their Facebook page, they are unlikely to remove the campaign tracking values. This means that any of their friends who click on the Facebook link will now also be marked up in your analytics as having come from the customer_newsletter campaign via email.

In a way, you could say the root source of the visit is from the email campaign as the subscriber wouldn’t have shared it otherwise. However, the description no longer accurately describes the visit from the Facebook friend also using that link. This means the actual numbers attributed to the specific medium and source are not exactly correct.

Overwrites Channel Type Tracking

When you use campaign tracking links, visits from those links are always attributed to the Campaigns channel type. For example, if you share your campaign tracking links on social media, visits from those links would appear to come from the Campaigns channel instead of Social Networks within your Matomo Acquisition reports.

Channel Type Table

This can heavily influence the channel type reports and make it look like you don’t get much traffic from social media when in reality there may be quite a few visits coming from sites such as Facebook through campaign links. This means it is important to include the social network within your campaign tracking values for links shared on social media, so you get a realistic picture of the channels your campaign visitors are coming from. For example, you might include the mtm_source parameter with the value facebook so it is clear when campaigns are associated with the social network.

How to Install the Marketing Campaigns Reporting plugin

If you are using Matomo On-Premise or Matomo for WordPress, you will need to install the free Marketing Campaigns Reporting plugin to get the additional tracking parameters for a total of eight. You can find the instructions for installing it to each version below.

How to Install Marketing Campaigns Reporting to Matomo for On-Premise

  1. Login to your Matomo dashboard.
  2. Click the cog icon Settings Cog Icon in the blue top menu.
  3. Within the System menu, click on the Plugins menu item.
  4. Click on the big green Install New Plugins button.
  5. Locate the Marketing Campaigns Reporting plugin within the list of plugins and click Install. You may need to input your password at this stage to confirm.
  6. Click the green Activate Plugin button.

Once you have installed the plugin, there is no additional configuration required. You can simply start using campaign tracking URLs within your marketing and they will begin showing up in your marketing reports.

How to Install Marketing Campaigns Reporting to Matomo for WordPress

If you haven’t already installed the Matomo Marketplace plugin, you will need to do that first by following the steps to install plugins for the WordPress version of Matomo. Once the Matomo Marketplace for WordPress plugin is active, you can use it to install the Marketing Campaigns Reporting plugin.

Reporting on Marketing Campaign Tracking URLs

Once you have collected some campaign tracking data, it is time to put it to good use. The primary way to analyse Campaign Tracking data is on the Campaigns page found in the Acquisition section of the Main Navigation menu in Matomo.

Marketing Campaign Acquisition Reports and Alternative Visualisations

On the Campaigns page, you will see a table for each of the campaign parameters. By default, a simple table is shown, which summarises the number of visits from each traffic source. This is helpful for understanding which platforms and placements bring you the most traffic. However, there are alternative visualisations which provide even more data.

To access alternative visualisations, hover your mouse over the table until a green menu containing four icons appears below the table.

Campaign Mouse Hover Menu

The first of these icons, the green cog icon Cog Icon, enables you to add a totals row to the table, or exclude values that haven’t received much traffic. The second icon changes depending on which visualisation is enabled (table icon Table Icon by default). However, if you click on the active icon, several visualisations are available:

Simple table

The Simple Table visualisation is the one loaded by default. It shows you the number of visits associated with each campaign. You can also hover over the visit column to see the visit number as a percentage of all campaign traffic. This view is useful for understanding which of your campaigns bring you the most traffic, so you can focus on, and replicate the successful ones.

Simple Campaign Table

Table with Visitor engagement metrics

This next visualisation is represented by the table plus icon Engagement Table Icon. It provides a more comprehensive overview of visitor engagement from your campaigns. You can explore metrics for each campaign, including: actions, actions per visit, average time on website, and bounce rate. This can help you build a picture of not only which campaigns brought the most traffic, but also how interested those visitors were.

Campaign Name Table

You will generally be looking to increase actions per visit and time spent on site. On the flip side, you will typically want to see a low bounce rate if campaigns are reaching the right audience, as this tracks visits where somebody immediately leaves without taking any other actions.

Table with Goals metrics

This visualisation is represented by the goals table icon Goals Icon. It includes the following for each campaign value: an Ecommerce order conversion rate, a conversion rate for each goal you have configured, and revenue per visit. The Table with Goals metrics is useful for analysing the campaigns variations which are delivering people who complete goals and complete purchases on your website. This visualisation is especially helpful for checking your campaigns are bringing in the right traffic as well as volume.

Table With Goals Metrics

Insights

The Insights visualisation provides an overview of your improving and declining campaigns. It displays the additional or reduced (not total) number of Visits, as well as the percentage that value has changed (Evolution) for each campaign within the chosen reporting period.

Campaign Insights Table

While campaigns will organically drive more or less traffic as you release and retire them, this can bring your attention to campaigns that are under or over-performing whilst active. This feature enables you to quickly identify new growth opportunities or campaigns that may be heading into trouble so you can adjust your marketing focus.

Vertical bar graph

Bar graphs provide a visual indication of your top-performing campaigns so you can see how they are performing against each other. This visualisation can be applied to visits, actions, conversions, and total revenue. To select which metric is shown, hover your mouse over the graph and click on the metrics icon Line Chart Icon to the top left of the graph to bring up a menu which allows you to pick alternative metrics.

Campaign Bar Graph

Pie chart

With this visualisation, you can plot your campaigns as segments of a pie chart. This helps you identify campaigns that generate a larger proportion of your website engagement. By default, the Visits metric is shown but you can hover your mouse over the metrics icon Line Chart Icon at the top left of the pie chart to select alternative metrics. The metrics available within this visualisation include: actions, conversions, and total revenue.

Campaign Pie Chart

Tag Cloud

This is a simplified visual reference for comparing a campaigns performance in relation to your other campaigns. The bigger and bolder a value is, the more visits it is associated with. This is great for sharing in external reports for people who aren’t used to reading charts. It is best used when there is a big gap between values because similar values will not display that differently in this view.

Campaign Tag Cloud

How to Filter Campaign Parameters within the Tag Cloud

If you want to look at a specific group of campaign tags in relation to each other, you can search for their common naming patterns. To do this, hover your mouse over the tag cloud area to load the green hover menu and then click the search icon Search Icon to activate a search box. You can then type in the common campaign value you are looking for to bring up all tags containing this text. In the above example, you could use this to compare all campaigns containing app_help as part of their name.

Marketing Campaign Reporting for Goals with Matomo

Within the Goals section of Matomo, you can find campaign statistics broken down by each campaign parameter. On the Goals Overview page, scroll down until you see the Goals by Referrers section and you will see the links to each of the campaign tracking reports:

Campaign Goals Report Links

Click on the specific campaign parameter that you would like to analyse to load a table containing relevant goal data. The metrics that are available within these reports for each campaign parameter are:

  • Visits attributed to each campaign value
  • Number of Goals attributed to each campaign value
  • Conversion rate of each goal from each campaign value
  • Revenue from each goal from each campaign value
  • Revenue per visit for each campaign value

Combined, these metrics should provide a good overview of how much each campaign variation is contributing to your site’s goals. You can easily see if certain campaigns are likely to attract users that complete a particular goal instead of another. Or, if there is a certain traffic source that does well across all of your metrics, it is probably worth further investment.

Marketing Campaign Reporting for Ecommerce with Matomo

To analyse your Ecommerce sales metrics in relation to your campaigns, visit the Ecommerce section of Matomo. Once there, click on the Sales sub-menu and look for the Sales by Referrers section where you will find reports for each campaign tracking parameter.

Campaign Sales Report Links

Click on the specific campaign parameter you would like to analyse, for example, Campaign Names, to load a table containing relevant ecommerce data. The metrics that are available within each of these reports are:

  • Visits
  • Ecommerce Orders Total Revenue
  • Ecommerce Conversion Rate
  • Purchased Products
  • Revenue Per Visit

All of the above values are broken down for each campaign variation within the table. This allows you to see exactly how much revenue each campaign is generating for your site. If you are paying for individual campaigns, these figures can help you calculate your return on investment (ROI). Additionally, you can also compare the conversion rate and the number of products purchased by visitors from each campaign variable. These metrics can help you identify which campaigns are more likely to increase your sales volume with further investment.

Using Campaign Data to Improve Conversions

When optimising your campaigns, you should keep campaign feedback cycles in mind. For example, a social media post is likely to get the majority of its traffic within the first minutes and hours. In contrast, a tracking link behind a QR Code in a printed magazine will have a much longer lifecycle, and could generate visits for weeks or even months depending on its distribution.

Schedule a reasonable time in the future to come back and look at the reports described above whenever you publish a campaign tracking link. Once adequate time has passed, you can use your campaign data to tweak existing campaigns, and to help decide whether to repeat or delete specific campaigns. As a general rule of thumb, we recommend checking on your campaigns at the following intervals:

  • Social Media Posts: One day later
  • Email Newsletters: Three days to one week later
  • Paid Display Campaigns: Weekly or Monthly
  • Third Party Websites: Weekly or Monthly

You should have specific goals for each marketing campaign that you run. Make sure to check your Goals or Ecommerce metrics as well as your visits using the reports described above.

If you make significant changes to a campaign, you should generally update the campaign URL parameter values. However, if you keep them the same, you should make a note on the date of the change using the annotations feature within Matomo.

Advanced: How to Manually Build Campaign Tracking URLs

Campaign Tracking URL Structure

It is useful to be able to recognise the components of a campaign tracking URL. With this knowledge, you can type your own or at least verify automatically generated tracking links.

Campaign Tracking URL

The image above shows an example campaign tracking URL with the campaign tracking components highlighted in different colours. In order, the components of a campaign tracking link are:

  1. Standard URL (Shown in Black): The destination of the link.
  2. ? or # Symbol (Shown in Gray): This is a standard method for adding data to links.
  3. Parameter Name (Shown in Orange): These define which campaign tracking parameter is being used.
  4. = Symbol (Shown in Gray): Separates the parameter name from its value.
  5. Parameter Value (Shown in Blue): The campaign value to be tracked in Matomo.
  6. & Symbol (Shown in Gray): Used to separate additional campaign tracking parameters.

Components 3-6 can be repeated for as many campaign tracking parameters as are needed from the eight available. You don’t need to add an ampersand “&” symbol after the final parameter. Below is an example link using all eight campaign tracking parameters:

https://example.com/?mtm_campaign=email_sale&mtm_source=newsletter&mtm_keyword=campaigns&mtm_medium=email&mtm_content=example_link&mtm_cid=1234&mtm_group=customers&mtm_placement=footer_banner

Alternative Campaign Tracking URL Configurations

URL Fragment Tracking

Campaign tracking values are typically set via query parameters on your URL. This means the first parameter is preceded by a ? and each subsequent parameter is separated by the & symbol. For example:

https://example.com/?mtm_campaign=documentation&mtm_keyword=demo

However, some content management systems may use standard query parameters for navigation. In those cases, it can be safer to use the alternative fragment system by adding campaign parameters after a # symbol, with each subsequent parameter separated by an & as shown below:

https://example.com/#mtm_campaign=documentation&mtm_keyword=demo 

Campaign Tracking Compatibility with Alternative URL Parameters

Campaign tracking is a popular tool used across millions of websites, so there are a few alternative implementations in use. Luckily Matomo has been built with this in mind and supports all of the most popular alternatives out of the box. This means if you have been using campaign tracking links with another tool, it will likely work automatically, and if not, there is the ability to add your own.

When creating new links with Matomo Cloud or self-hosted versions of Matomo from version 4.0 and above, it is recommended you use the standard mtm_ prefix, as in mtm_campaign. However, for support of alternative and older implementations, the following prefixes will also be recognised in place of the standard mtm_ prefix:

  • matomo_
  • pk_
  • piwik_
  • utm_

For example, the following parameters are all recognised and accepted by default for the Campaign tracking parameter:

  • mtm_campaign
  • matomo_campaign
  • pk_campaign
  • piwik_campaign
  • utm_campaign

Both pk_ and piwik_ were the parameters used in older versions of Matomo (3.x and below) and Google Analytics uses utm_ . If you are already using campaign tracking URLs with parameters that are not recognised by default, then it is possible to customise your Matomo instance to accept additional parameters.

Further resources