Campaign tracking in Matomo Analytics (formerly Piwik Analytics) lets you track how efficient various marketing campaigns are in bringing visitors to your website (visits, page views, etc.), how well these visitors convert and how much revenue they generate.

Campaigns can track various ways of acquiring traffic, such as:

  • Yahoo! Search Marketing, Google AdWords
    ), Microsoft adCenter: Paid search marketing campaign, Cost Per Click (CPC)
  • Display Ads, Banners
  • Links in Newsletters, Emailing
  • Affiliates links (sometimes called Subids tracking)
  • Tweets
  • Facebook Ads

Maybe you are already spending money bringing visitors via Adwords, Yahoo, Facebook, etc. to your website. Tracking Campaigns will let you know how successful these campaigns are in bringing new visitors (how many visits? pages? downloads?) and whether they are converting to your Goals.

For example:

  • What is the conversion rate for visitors coming from Adwords VS Yahoo! search?
  • How much revenue was generated from visits via your monthly newsletter?
  • If you buy display adverts on Facebook, how much revenue on your Ecommerce website was generated by each advert? Which Facebook advert performed the best?

Tracking Campaigns using URL Parameters

Campaign tracking in Matomo (Piwik) is simple: add one (or up to five) parameter(s) to your website URL. For example, instead of putting a link to your website such as https://example.org/landing.html in your email newsletter or Adwords destination URL, you would instead put a link to https://example.org/landing.html?pk_campaign=Email-Nov2018

All visitors who open the email and click on the link will arrive on your website. Matomo (Piwik) will track the visit, and detect the parameter pk_campaign in the URL of the first page view, and the visit will be credited to the Referrer > Campaign: “Email-Nov2018”.

Screenshot of the Analytics Campaign reports showing various marketing campaigns: Adwords, Facebook, Newsletter, Display ads

Matomo (Piwik) lets you define up to five parameters in your page URLs. We recommend to install the free MarketingCampaignsReporting plugin from the Marketplace, as by default there are only two parameters available.

For example, if your Email newsletter contains various calls to action: “Learn more” and “Order now”, you could tag the links as follows:

1) <a href="http://example.org/landing.html?pk_campaign=Email-Nov2018&pk_kwd=LearnMore">Learn more</a>
2) <a href="http://example.org/landing.html?pk_campaign=Email-Nov2018&pk_kwd=OrderNow">Order now</a>

Matomo (Piwik) also supports detecting the campaign parameters in the hash tag. The advantage of using the hash tag is that your campaign tracking URLs will not be considered “duplicate URLs” by search engines. The following URLs will work:

1) <a href="http://example.org/landing.html#pk_campaign=Email-Nov2018">Click here for more info</a>0
2) <a href="http://example.org/landing.html?q=test#pk_campaign=Email-Nov2018&pk_kwd=OrderNow">Order now</a>

In the report Referrers > Campaigns, you would then be able to click on the row “Email-Nov2018” and see how the two links performed:

On a click on a Campaign name (value of pk_campaign) are displayed the specific links clicked in the newsletter (if you tracked it via in pk_keyword parameter)

Tracking campaigns is easy: you don’t need to edit your Matomo (Piwik) Tracking code, only the URLs pointing to your website. You can track an unlimited number of campaigns (and keywords). You do not need to configure campaign names in advance. Just use them in the links to your website and visitors following those links will be tracked as campaign referrers.

Campaign URL Generator

It can be a bit tricky to manually generate URLs for use in your in your Email newsletter, or your paid ads or Affiliate URLs. To make sure your URLs are correct, you can use the following tool which will create the URL, that you can then copy and paste wherever you are linking your website.

ยป Matomo (Piwik) URL Builder tool

We highly recommend that you bookmark the link to the URL Builder: https://matomo.org/docs/tracking-campaigns/url-builder/ and use it as often as possible to tag all your links, which is the first step to getting better insights into your campaigns’ performance in Matomo (Piwik).

Campaign attribution for Ecommerce and Goals conversions

A same visitor will sometimes visit your website multiple times (hopefully, often!), perhaps using a few different referrers.

For example, a visitor can find your website by clicking on a Display Ad, then two days later come back by typing a keyword in Bing, and then a week later comes back by directly typing the URL of your website. If the visitor then buys a product on your site, should the “revenue” from this purchase be attributed to the Display Ad, or to the keyword typed in Bing?

Piwik, by default, will attribute the conversion to the last non empty referrer used to access the site: Bing in this example. Alternatively, you can configure Matomo to credit the first Referrer. As users typically visit your website several times, using different campaigns and referrers, you can find out the true success of your campaigns by applying more accurate attribution models using the Multi Channel Conversion Attribution premium feature.

The referrer and campaign information is stored in a first party cookie, by default for six months. This can be customized using the Javascript setReferralCookieTimeout().

The attribution data can be access using the Javascript tracker methods such as getAttributionCampaignName(), getAttributionCampaignKeyword() or getAttributionReferrerUrl().

Tracking up to five campaign parameters

By default Matomo (Piwik) is able to track two dimensions: the campaign name and the campaign keyword. The MarketingCampaignsReporting plugin lets you track up to 5 dimensions for campaigns: campaign name, campaign source, campaign medium, campaign keyword, campaign content. For example:

Tracking Paid Search Ads

If you are buying specific keywords on Search Engines (SEM), you typically want to measure each individual ad. When visitors click on your paid adverts in the search results, the click URL to your site should contain the actual keyword you bid on. Typically it’s possible to use some variables in the URL so you don’t have to manually change all the destination URLs for the same advert. For example, imagine you are running a campaign to advertise the best summer deals, you would use the following URLs:

  • Adwords: the URL may look like: landing.html?pk_campaign={campaignid}&pk_kwd={keyword}&pk_source=google&pk_medium=cpc&pk_content={creative}

We also wrote a more detailed article about How to track Google AdWords campaigns with Matomo

It is highly recommend that you tag all your paid search marketing adverts carefully, to ensure that your analytics campaign reports show how the marketing money you spent is contributing to your website’s success.

Check out the Campaign URL Builder.

FAQ: Tracking campaigns

When a visitor clicks in an email newsletter, or in a paid search ad, it will show as a “Direct Entry” in Matomo (Piwik). Looking at your analytics reports, you will not be able to tell if the email newsletter or paid search ad (or Display ad, etc.) have made a positive impact on your website. Tracking campaigns in Matomo ensures that you will be able to tell exactly how many visits were generated with each campaign, how many pages the visitors looked at, the bounce rate, and also the conversion rate to your Goals, and the revenue generated by these visits. Tracking campaigns is a very important part of understanding your websites’ performance.

  • How do I use the Campaign tracking report to increase my website revenue or visitor engagement?

The Campaign report will tell you how well your campaigns are performing. We highly recommend that you set up Goals in Matomo (Piwik) for each website tracked, so you can use the metrics “Conversion rate” or “Revenue”. You will then be able to look at each individual Campaign performance (and even Keyword performance), and see what campaigns are generating more value (in particular, which campaigns are generating more than they cost you to advertise!).