Our users have a user ID that they use to login and it sets a cookie. I have setup our pages to use the value of this cookie as the user in Piwik.
What I would like to do is modify somehow the reporting so that the users portal shows not only the User ID but also the user name (I have a table that maps user ID’s to user names). How would I go about modifying Piwik to do that? If someone could point me in the direction of the correct documentation and/or some examples that would be most appreciated.
I believe the only way to do that is to hand over to piwik the actual name + id (like “Valdhor (434)” within the tracking code. Its not very clean and you’ve probably thought of that solution before. I’d be interested in a better way as well
You will need to create a little plugin. This plugin would be a little similar to this plugin I wrote: GitHub - mattab/piwik-plugin-ApiGetWithSitesInfo: Plugin for Piwik that modifies the 'API.get' output to also list the website name and main website URL.
When the API Users.getUserId is called you would apply a filter that will transform the user ids into your friendly user ids. Hope this helps