Does the API allows to get the users doing a specific action?


(Jonathan Dinh) #1

Hi,

I would like to use Matomo for identifying the users who perform a specific tracked action or event.

Did a search in the API reference but couldn’t find the answer to my need. Is it possible to get this kind of results with Matomo’s API? If yes, thanks for telling me how to do so.


(Roddy A. Stegemann) #2

I am a Matomo beginner like you and am learning how to track specific events. There are at least two ways to achieve this goal: content tracking and Javascript event tracking. I am sure that there are more, but these are the two primary ones.

Content tracking is based on tagged HTML elements for which the primary event trigger is the element and its corresponding href attribute.

Event tracking about which I know much less, but am rapidly learning more is based on Javascript function calls.

I will provide you with two links to the Matomo data base that you will likely find very useful: Content Tracking and the Javascript Tracking Event Guide.

Roddy


(Lukas Winkler) #3

Hi,

To further answer the question on how to filter on the API (e.g. by events or visited page):

You can either create a segment (witch the filter you need) in Matomo and access it via the API (they can even be preprocessed.

Or you can segment on the fly as explained here:
https://developer.matomo.org/api-reference/reporting-api-segmentation


(Jonathan Dinh) #4

Hi Roddy and Lukas, thanks for your replies!

Javascript tracking will fill more my need than content tracking since the user’s name is not displayed on my site.


(Roddy A. Stegemann) #5

How would the user’s name effect your decision between Content Tracking and Event Tracking?

From my humble perspective as a beginner I see no reason why you cannot use both forms of tracking on the same page.

Also, just because a user is not required to give his name does not mean that you cannot track him. You can track single-user activity by their IP address.

In the end, I do not understand why not having a user name would dissuade you from using Content Tracking.

Roddy


(Lukas Winkler) #6

for the sake of completeness:

If any of the users you are planing to uniquily identify per username are in the EU, you’ll need to consider GDPR and at the very least get their consent, but also have to keep in mind other things.


(Roddy A. Stegemann) #7

This is the reason that the opt-in/opt-out checkbox for use of a tracking cookie is so important. I spent an entire week just getting it to work properly.

Roddy