You are here: XR nl>Main Web>Tracking (14 Mar 2021, FleurXR)Edit Attach
-- FleurXR - 14 Mar 2021

For every button/video/form an tracking script can be implemented to get more insights in the behaviour of the visitors to be able to optimize the website according to this behaviour.

How to set this up:

Some of the buttons are coded in WordPress others are in the hardcode of the website. When you’re not able to add the code in WordPress it can only be done in the hardcode. However, to be able to track all relevant actions in Matomo both ways should be implemented in a similar manner.

In Wordpress:
  1. Add the script : onclick=''_paq.push(['trackEvent', 'Category', 'Event', 'Name']);''
Add that before the actual button: >Button text</a>

The script should contain the three parts. The most important thing is that this happens in an uniform way (!) following the next steps.
  1. Category=The specific type of item on the website. This can be: Button / Video / Form
  2. Event=The event that happened with this item. This can be: Clicked / Played / Sing-up
  3. Name= The name of the item where the event happened. This will always be: ‘’The URL of the page’’ – ‘’Name of the item’’.
  4. If there are 2 items with the same name on the same page the second item on the page should contain a 2 in the name.
  5. Check in matomo if the script is implemented correctly by checking the ‘’Bezoekerslogboek’’, when clicked you should see the following:
  6. The relevant data can now be extracted at ‘’Gedrag’’ and then ‘’Gebeurtenissen’’.
Example:

If you want to know how often the button ‘’Sluit je aan’’ on the ‘’Doe mee’’ page is clicked. You add the event using the following script. For the homepage the URL-part would be /.

Example: The javascript on wordpress without a tag would look like:

<a class="btn btn-lg btn-blue" href="/join" >Sluit je aan</a>

And with the code:

<a class="btn btn-lg btn-blue" href="/join" onclick="_paq.push(['trackEvent', 'Button', 'Clicked', '/doe-mee/ - Sluit je aan']);">Sluit je aan</a>

More info can be found here: https://matomo.org/docs/event-tracking/

In the Hardcode:

Will be added later.
Topic revision: r1 - 14 Mar 2021, FleurXR
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding XR nl? Send feedback