unicef / iogt

BSD 2-Clause "Simplified" License
25 stars 35 forks source link

Update Matomo tracking pixel URL to add missing data #1647

Open cbunicef opened 1 year ago

cbunicef commented 1 year ago

Currently the Matomo tracking pixel implementation only uses the required arguments:

<img src="/analytics/matomo.php?idsite=51&rec=1" style="border:0" alt="" />

In Matomo we are missing certain information when it comes from tracking pixel hits (presumably, sometimes it is hard to tell):

Here are Matomo's recommended arguments for the HTTP API (this is directly linked from the pixel tracking documentation so I assume it also applies):

action_name(recommended) — The title of the action being tracked. For page tracks this is used as page title. If enabled in your installation you may use the category tree structure in this field. For example, “game / register new user” would then create a group “game” and add the item “register new user” in it. url(recommended) — The full URL for the current action. _id(recommended) — The unique visitor ID, must be a 16 characters hexadecimal string. Every unique visitor must be assigned a different ID and this ID must not change after it is assigned. If this value is not set Matomo (formerly Piwik) will still track visits, but the unique visitors metric might be less accurate. rand(recommended) — Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy. apiv(recommended) — The parameter &apiv=1 defines the api version to use (currently always set to 1)

https://developer.matomo.org/api-reference/tracking-api