Tracking Marketing Campaigns
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 AdsMaybe 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 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 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 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 also supports detecting the campaign parameters in the hash tag. One advantage of using the hash tag for your campaign tracking URLs is that URLs with different hash tags still point to the same page URL and therefore are not considered to be “duplicate URLs” by search engines (assuming your Campaigns tagged URLs would be indexed by Search engines bots).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 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.
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.
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.
Attribution data is saved in a first party cookie
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 accessed using the Javascript tracker methods such as getAttributionCampaignName(), getAttributionCampaignKeyword() or getAttributionReferrerUrl().
Tracking up to five campaign parameters
By default Matomo 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 MatomoYahoo! Search Marketing:
landing.html?pk_campaign=Paid-Yahoo-SummerDeals&pk_kwd={OVKEY}
Microsoft Ad Center (Bing Search):
landing.html?pk_campaign=Paid-AdCenter-SummerDeals&pk_kwd={keyword}
(more information about Microsoft advertising tagging)- Yandex.Direct and Yandex Advertising Network:
landing.html?pk_campaign={source_type}-{campaign_id}&pk_kwd={keyword}
(more information about Yandex.Direct advertising tagging)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.
- Yandex.Direct and Yandex Advertising Network:
Check out the Campaign URL Builder.
FAQ: Tracking campaigns
- My URLs are tagged properly, but no Campaign is showing in Matomo Campaigns reports?
- Does Matomo support Google Analytics campaign parameters (
utm_campaign
,utm_medium
,utm_source
,utm_term
,utm_content
,utm_id
)? - How do I track how many users open and read my newsletter emails (using a pixel / beacon)?
- How do I customize the Matomo Campaign parameters
pk_campaign
andpk_kwd
? What is the advantage of tracking campaigns vs leaving the URL as is?When a visitor clicks in an email newsletter, or in a paid search ad, it will show as a “Direct Entry” in Matomo. 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 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!).