Hi, I'm getting familiar with Piwik and how to use it for custom tracking. What I want to do is basically track "usages" or custom log messages:
What is the best way to achieve this? I know Piwik has custom variables but they seem to me too limited for my usecase so I'm trying to find a way how to achieve this using custom PHP plugin. I was trying to find some tutorials/documentation but it shows basic PHP plugin without this custom tracking. When I tried to call the _paq.push as above, I'm getting
Right now I have 2 possible solutions:
Neither of them looks like ideal to me...
- in the tracked pages source code, I'd be calling something like (on demand, even multiple times in single page view)
_paq.push(["myCategory", "myParameter1", "myParameter2"])
- piwik automatically saves these logs to DB
- in Piwik, I'd have PHP plugin to process and display these data
What is the best way to achieve this? I know Piwik has custom variables but they seem to me too limited for my usecase so I'm trying to find a way how to achieve this using custom PHP plugin. I was trying to find some tutorials/documentation but it shows basic PHP plugin without this custom tracking. When I tried to call the _paq.push as above, I'm getting
Uncaught TypeError: Cannot call method 'apply' of undefined
Right now I have 2 possible solutions:
- With custom variables, I would probably have to create a "wrapper" JavaScript object that would check custom variables to avoid overriding and if needed it would call _paq.push(['trackPageView']); . I'm only worried about possible high network communication as it is not very efficient
- Create independent JS logger that would push data to some piwik-independent endpoint. This endpoint would save them to e.g. DB and Piwik PHP plugin would simply read them from DB display them
Neither of them looks like ideal to me...