Go Back

Changing conversion attribution from last to first click with Piwik PRO Tag Manager

Author

Why would you want to change it?

First, we should explain how Piwik goal tracking works (and you can learn more about it from our Goals User Guide) To quote a FAQ entry from the Piwik website:

When visitors convert a Goal, Piwik tries to attribute the conversion to the referrer that brought the visit to the site. Piwik will credit this Goal conversion to the last non empty referrer used by the visitor (ie. the last time the visitor came to the website with a referrer that was not a direct entry).

But what if we want to know which source and medium was responsible for acquiring visitors who converted? We can easily tell Piwik to track the referrer which was first in a conversion process. To do this we just need to add one specific line to the main Piwik code. Let’s see how we can do this quickly via Piwik PRO Tag Manager.

Piwik PRO Tag Manager Configuration

This modification requires you to manually alter the main Piwik code, not via a Piwik template. Why? Because this additional line of code has to be called BEFORE calling out with the trackPageView() method.

Note: if you have implemented the Piwik integration with a tag template skip to the next chapter.

Let’s set this up. Go to your Tag with the Piwik main code and add this line

_paq.push(['setConversionAttributionFirstReferrer', true]);

Before

_paq.push(['trackPageView']);

To picture this, check out the screen below:

Piwik code customization via Piwik PRO Tag Manager
Piwik code customization via Piwik PRO Tag Manager

What if the Piwik main code is already implemented via Piwik template?

To implement this feature, we have to switch to code manual insertion. To do this find a Tag with your Piwik main implementation:

Piwik code tag
Piwik code tag

And click on the name – in this case it’s Piwik Pro.

To change the type of tag Click on the Asynchronous custom HTML tag.

Coosing custom template in Piwik PRO Tag Manager
Coosing custom template in Piwik PRO Tag Manager

In the Tag HTML field we have to paste the Piwik Code. It can be found in the Piwik platform Administration panel (1) under Administration and Websites (2). Just find your website and click on the link called: View Tracking Code (3).

Viewing tracking code in Piwik PRO
Viewing tracking code in Piwik PRO

On the next screen, the tracking code is visible and ready to copy & paste into Tag HTML field. This is the best time to add additional line in question:

_paq.push(['setConversionAttributionFirstReferrer', true]);

Remember that it must be pasted before

_paq.push(['trackPageView']);

Lets check out the screen below with featured already inserted:

Piwik code customization via Piwik PRO Tag Manager
Piwik code customization via Piwik PRO Tag Manager

When it comes to the trigger configuration, we don’t want to change anything – the Piwik main integration should fire on every page. The configuration of the Trigger should look like this:

Creating trigger for all pages
Creating trigger for all pages

Now Save all changes and Publish the updated tag into the world:

Publishing last changes
Publishing last changes

From now on, Piwik will report the first referrer in all goal reports.

As you can see, these kinds of changes can be implemented quite quickly and easily when we are using the Piwik PRO Tag Manager. We don’t have to bother an IT team member extra tasks and wait ages for their response. So be sure to check out our Tag Manager User Guides to learn more.

Free Comparison of 5 Enterprise-Ready Tag Management Systems

Get to know the 40 key differences between Google Tag Manager, Tealium, Adobe Dynamic Tag Management, Ensighten & Piwik PRO:

Download FREE Ebook

Author:

Szymon Grzesiak, Marketing Tech Lead

Experienced Performance marketing Specialist with tech knowledge.

See more posts of this author
Free Comparison of 5 Enterprise-Ready Tag Management Systems
 Free Comparison of 5 Enterprise-Ready Tag Management Systems

Share