# How to track custom events?

**URL:** <https://community.piwik.pro/t/how-to-track-custom-events/3079>\
**Category:** Data collection and tags\
**Created:** [October 23, 2023, 12:28am UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079 "2023-10-23T00:28:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohga\_Megahed](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mohga_megahed/32/2507_2.png) [@Mohga\_Megahed](https://community.piwik.pro/u/Mohga_Megahed)\
**Post date:** [October 23, 2023, 12:28am UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079/1 "2023-10-23T00:28:47Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![asinior](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/asinior/32/1905_2.png) [@asinior](https://community.piwik.pro/u/asinior)\
**Post date:** [October 23, 2023, 7:15am UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079/2 "2023-10-23T07:15:14Z")

</div>

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](https://help.piwik.pro/support/tag-manager/event-trigger/)

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](https://help.piwik.pro/support/getting-started/custom-event/)

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/](https://help.piwik.pro/)

---

<div class="post-metadata">

**Author:** ![Mohga\_Megahed](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mohga_megahed/32/2507_2.png) [@Mohga\_Megahed](https://community.piwik.pro/u/Mohga_Megahed)\
**Post date:** [October 23, 2023, 11:18am UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079/3 "2023-10-23T11:18:31Z")

</div>

Hi,

the object is present in the dataLayer structure when I debug ,  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/7/7842432c1fe20f7cf9367026fd8d5055bccd9106.png)

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

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/3/3fe1d657f964bacc1a401ab3dcfc8eeba1376a9e.png)

but I still can`t see the the object`s data

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/a/a5b653d9a0c42d54ff721fb735ee443f4fa62430.png)

---

<div class="post-metadata">

**Author:** ![asinior](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/asinior/32/1905_2.png) [@asinior](https://community.piwik.pro/u/asinior)\
**Post date:** [October 23, 2023, 11:25am UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079/4 "2023-10-23T11:25:00Z")

</div>

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](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/e/eedc2cf8e733d9b72dc684729bc037e4f9452b92.png)

---

<div class="post-metadata">

**Author:** ![Mohga\_Megahed](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mohga_megahed/32/2507_2.png) [@Mohga\_Megahed](https://community.piwik.pro/u/Mohga_Megahed)\
**Post date:** [October 23, 2023, 2:08pm UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079/5 "2023-10-23T14:08:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mohga\_Megahed](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mohga_megahed/32/2507_2.png) [@Mohga\_Megahed](https://community.piwik.pro/u/Mohga_Megahed)\
**Post date:** [October 23, 2023, 4:55pm UTC](https://community.piwik.pro/t/how-to-track-custom-events/3079/6 "2023-10-23T16:55:45Z")

</div>

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