How to install Piwik Pro on your website using Google Tag Manager?

If you are from Web Analytics domain, there is a good probability that you have heard about Piwik. Piwik is an open source web analytics solution. It can be installed on your server as a software. It works through traditional JavaScript implementation.

The advantage in this method is the privacy you get for your data. But it requires decent resources on your server. So Piwik now came with a cloud solution called Piwik Pro. Of course it is a premium tool with a cost. The cost depends on the number of actions that take place on your website. Action can be any server call to the Piwik Server. Fortunately it comes with a 30 day free trial.

Piwik Pro + Google Tag Manager

Let’s see how to install Piwik Pro on your website. For this we will be using Google Tag Manager. Google Tag Manager is a free Tag Management solution provided by Google. I will be writing soon on how to install Google Tag Manager on your website. In my guides I will be using one of my websites called Storygag.com for demonstration.

Set up Piwik Pro account

Sign up for a Piwik pro free trial account by visiting this link

piwik-registration-step-free-trial

 

Fill out the necessary details related to your website. You will be presented with the following JavaScript tracking code. This needs to be placed on every page on your website.

piwik-js-tracking-code

 

On the final step you can configure some important settings related to user’s privacy. Choose these options carefully depending upon the country where you are operating from. If your country’s law doesn’t prevent you from collecting IP addresses, you can go ahead and uncheck this box.

piwik step 3 setup

 

Creating a new tag in Google Tag Manager

Now that we have the tracking code with us, open Google Tag Manager. Create a new tag.

google tag manager new tag

 

Choose “Custom HTML Tag” as your tag type. Paste the Piwik JavaScript code in the Configure Tag section. Choose the firing rules as All Pages. This makes our code to load on all pages.

google tag manager piwik base tag 2

 

Publishing the changes of Piwik in Google Tag Manager

That’s all, save the tag. Publish your changes by clicking the Publish button on the top. You have successfully placed the Piwik on your website. You should start seeing the data on your Piwik dashboard

publishing changes google tag manager

 

Snapshot of Piwik Dashboard

Below is a snapshot of the Piwik dashboard. Piwik provides real time visitor log as well. This is a nice way to know whether your code has been placed properly or not.

piwik-dashboard

 

Piwik Custom Event Tracking using Google Tag Manager

Now that we have installed the base tag, it’s time for us to do some custom tracking. Let’s see one example on how to track a custom link.

Create a Click Listener in Google Tag Manager

Add a new tag on Google Tag Manager. Select the tag type as “Click Listener”. Select the firing conditions as “All Pages”. Now your click listener listens to all the clicks that are happening on your website.

add click listener on all pages

 

Create a custom HTML tag for Piwik Event Tracking

Now create another Custom HTML Tag. Paste the below code in the configure tag section. Select the Firing rules as “Click”

 

creating home page click event

 

Configuring the Trigger

Now create the trigger for the Home page carousel link tracking. Select the configuration as shown in the below screenshot. Select all elements in configure trigger section and select the firing rules.

creating trigger in google tag manager

 

We are tracking home page carousels. It’s time to identify the unique HTML attribute to tag these elements. The class name “entry-thumbnail”  is the common class name for these elements. Select the element classes in the first column and select the condition. Enter the value as shown below. Save the trigger.

creating-trigger-2 in google tag manager

 

That’s all the home page carousel will be tracked as a custom link. I will write more about Piwik Pro and JavaScript custom tracking in the later posts.

Try out the Piwik pro trial and let me know how do you feel about it.

Ram Manohar

Author: Ram Manohar

Independent Digital Analytics and Tag Management Consultant. Web Analytics Expert with 8+ years of experience. Well versed in Digital Analytics, Web Programming, WordPress and Digital marketing. Contact me for consulting!