Advanced Tracking Code Modification
Please note that examples below are made using the Piwik PRO Tag Manager, but with additional effort can also be achieved without it.
Next, you’ll need to fill some information that you’ll want to be stored in Piwik PRO:
And configure a trigger that will activate the PageView. the “Click” trigger firing whenever the correct click ID is clicked works pretty well in such situation but feel free to experiment with other triggers as well:
And that’s it! just hit the save button, repeat for your other pages and publish to start tracking pageviews.
Custom Events are very similar to virtual pageviews, the setup looks almost the same as above but instead of providing URL’s and Page Title, you provide the custom data grouped as Category Action Name and Value.
What you ‘ll store in those fields is up to you. The other difference is that while Virtual Pageviews will be displayed in Piwik in the Actions/Pages report, the Custom Events will be stored in the Actions/Events menu.
Tracking a goal
While Piwik PRO offers some standard option that allows recognizing a goal conversion, you may always want to track goal manually, whenever a condition of your choosing happens. To do that you need to use following method at the moment of conversion:
Instead of manually pasting this inside of your website code, you can use the Piwik PRO Tag Manager to fire the code for you. First of all, create a new custom HTML tag:
Inside of the Tag HTML Code paste following:
<script> _paq.push(['trackGoal', <GOAL ID>]); </script>
Where <GOAL ID> equals the ID of your goal, this can be found inside of your Analytics section, in the Goals tab under “Manage Goals”.
Next, you need to setup a trigger to choose when the Goal should be converted, for that feel free to use the wide variety of predefined and configurable triggers offered by the Piwik PRO Tag Manager.
Piwik PRO Tag Manager also greatly simplifies tracking of UserID of your visitor. First of all, you’ll need to create a variable that will hold the UserID parameter that you want to pass to Piwik ( ex. user email address).
In this case, the variable is pulling text content from a DOM element signed with ID “username”. This method is by no means a universal one and you’ll need to figure out your own best way to pass the username to Piwik, but there are a lot of other methods that can be used to pull data from your website, feel free to test PPTM Variables feature to find the best method for your website. And should you find yourself stuck or have any questions, feel free to contact our support.
When you’ll have your variable configured, all you need to do is switch the “Set user ID” switch in your Piwik PRO tag settings: