matomo-org / matomo-nodejs-tracker

A Node.js wrapper for the Matomo (Piwik) tracking HTTP API
MIT License
117 stars 41 forks source link

Basic Query #69

Closed Leoudayan closed 3 years ago

Leoudayan commented 3 years ago

Hi,

Sorry for posting this here but couldn't find a place to ask this question.

I am running a Node js express service where I want to report a certain action under a route.

  1. I installed the package.
  2. initialised the site ID. (I basically copied the site and ID from the javascript tracking code which gets displayed on the front page of the matomo home page).
  3. Now, inside the route, where a certain action successfully performed, I entered the matomo.track('URL to Track');

When I run the express service and called the route, nothing happened and also no errors. But I cannot see the tracking info coming after the trigger.

Is it possible to just report to matomo that a particular action inside a route is successfully executed? I don't want to track the route but from the route, i want to talk to matomo that a certain action is completed. Is is possible to do this with this package?

It will be great if you could help me with this. I am very new to matomo.

Findus23 commented 3 years ago

Hi,

Anything is possible with this package as it just takes the parameters you give it and sends it to the Matomo tracking API. (https://developer.matomo.org/api-reference/tracking-api)

https://github.com/matomo-org/matomo-nodejs-tracker/blob/fd630686a9877fbf047fa8f5d12ee4db1dbd72fc/index.js#L54-L86

In theory this should work, but you might want to temporarily enable debugging and change the code so that the response from Matomo is logged. With this setting Matomo responds with a verbose log on why the request is (not) tracked in the tracking API request.

Leoudayan commented 3 years ago

Hi, Thanks for the link and code. I found out the error and fixed it. Thanks.