How to track custom events?

I am new to analytics and piwik pro , What I am trying to do is to capture my events from js,I added this code to my page

document.getElementById(“test”).addEventListener(“click”, function() {
window.dataLayer = window.dataLayer || ;
window.dataLayer.push({
‘event’: ‘registrationComplete’,
‘registrationCountry’: ‘United States’,
‘plan’: ‘Premium’
});
});

How Can I see the data object in piwik ?

Hi,
Welcome to the community!

I am not sure what you mean with seeing the data object in Piwik PRO, however, dataLayer objects can be used for triggering tags. More information about how to use dataLayer events to trigger your tags can be found here: Data layer event trigger | Piwik PRO help center

Also, if you want to track your custom events, here is a handy article on how to do just that: Create a custom event | Piwik PRO help center

You could set up a custom event tag and fire it whenever the object that you mentioned is present in the dataLayer structure.

If you are new to Piwik PRO then I would recommend going to our Help center which contains a lot of useful resources which may help you get a good grasp of what analytics is and how our tool works. Here is a link to the help center: https://help.piwik.pro/

Hi,

the object is present in the dataLayer structure when I debug ,
image

what I did is that I created a tag and a trigger and dataLayer variables to show my object and I used these variables in the tag

but I still cant see the the objects data

It seems that you only used Custom event category (Category in custom event tag) dimension to filter the report out. There are also Custom event action (Action in custom event tag), Custom event name (Name in custom event tag), and Custom event value (Value in custom event tag). Try including these dimensions in your report and see what the outcome would be.

image

what should I set the values of these dimensions Custom event action (Action in custom event tag), Custom event name (Name in custom event tag), and Custom event value (Value in custom event tag), Can you give me an example plz ? I set it is values to my variables name but this didn`t work

It is working now , thank you so much for your help