It is possible to create a simple affiliate mechanism using Matomo. For this system to work, you give your affiliate a special URL parameter they use to link to your website. Then you can track all new customers and revenue generated by each of your affiliates using Matomo.

Track users and customers with an affiliate URL parameter

When your affiliates send to you new leads, they would append to their URL linking to you a new parameter: &pk_cpn=Affiliate-XYZ. When users will click a link to your website URL and including this pk_cpn parameter (which is an alias of pk_campaign), then the user will be tracked as coming from a Campaign named Affiliate-XYZ.

Reporting affiliate conversions and revenue

To track conversions and revenue:

  • First you create a goal and set a Revenue for your goal which tracks the actual revenue of each conversion.
  • ​​Then in Matomo > Goals, you would be able to see how many visitors came from each affiliate by looking at the « Conversions » and « Revenue » metrics in your Campaign names report for your goal.
  • You are then able to use this report to calculate what revenue to pay your affiliates.

Instead of creating a Goal, you can use Ecommerce and see how many products and total sales each affiliate has generated.

Accurately credit your affiliates who first brought you the leads

In most cases your affiliates are the ones who first refer new leads to you. But by default Matomo credits the « last seen referrer » which will cause many affiliate conversions to be missed. You therefore need to manually enable the « First seen referrer » attribution in your website, to accurately attribute your affiliates who first brought you customers. Read our First seen referrer attribution FAQ.

Customising the affiliate URL parameter

Above we recommended you include the pk_cpn or pk_campaign parameter in your landing pages, but you can use another URL parameter by following the step below. This may be useful if for example you already have several links pointing to your websites which may use another URL parameter such as ref or affiliate_id. To define a new alias for this URL parameter, edit your config.ini.php file and under the [Tracker] section, define the comma separated list of valid campaign name parameters as below:

[Tracker]
campaign_var_name = "ref,affiliate_id,pk_cpn,pk_campaign,piwik_campaign,utm_campaign,utm_source,utm_medium"

In this example we added ref and affiliate_id as URL parameters at the start of the list, and we still leave the « default » parameters to make sure we still track any other campaigns that may use these. After changing this setting, any user coming to your page example.com/welcome.html?ref=AFFILIATE_ID_HERE will be categorised as campaign acquisition channel.

Limitations

Using Matomo as a simple affiliate system has some known limitation:

  • If customers weren’t tracked by Matomo for some reasons (using ad-blockers, opted-out, or other reasons), then the goal conversion and the revenue wouldn’t be tracked at all, and therefore wouldn’t be attributed correctly to the affiliate.