# Setting custom dimension value for a custom event

**URL:** <https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892>\
**Category:** Data collection and tags\
**Created:** [August 10, 2022, 9:57am UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892 "2022-08-10T09:57:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lisa](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@lisa](https://community.piwik.pro/u/lisa)\
**Post date:** [August 10, 2022, 9:57am UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892/1 "2022-08-10T09:57:20Z")

</div>

Hi @Admin,

I follow this method and set up this tag :

```auto
_paq.push(["trackEvent", {{Category}}, {{Action}}, {{Label}}, 
     {
       dimension2: {{dimension2}},
       dimension3: {{dimension3}},
       dimension4: {{dimension4}},
       dimension5: {{dimension5}},
       dimension6: {{dimension6}}
     }
     ]);

```

However, no values appears in my hit. Then I tried to put this code in my configuration tag or/and in my event tag and the dimensions appears in my hit but they are empty.

```auto
_paq.push(['setCustomDimension', 2, {{dimension2}})
_paq.push(['setCustomDimension', 3, {{dimension3}})
_paq.push(['setCustomDimension', 4, {{dimension4}})
_paq.push(['setCustomDimension', 5, {{dimension5}})
_paq.push(['setCustomDimension', 6, {{dimension6}})

```

So I wanted to know where do I have to put each part of the code, in my configuration tag ? in my event tag ? Do I have to put both ?

Thanks for your help

---

<div class="post-metadata">

**Author:** ![mbaersch](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mbaersch/32/35_2.png) [@mbaersch](https://community.piwik.pro/u/mbaersch)\
**Post date:** [August 10, 2022, 10:16am UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892/2 "2022-08-10T10:16:50Z")

</div>

Hi,

there are maybe several problems that prevent the data from showing up in reports: First of all, your \_paq.push([“trackEvent”…) call misses an eventValue. Add a 0 of no value is present and try:

```auto
_paq.push(["trackEvent", {{Category}}, {{Action}}, {{Label}}, 0, 
     {
       dimension2: {{dimension2}},
       dimension3: {{dimension3}},
       dimension4: {{dimension4}},
       dimension5: {{dimension5}},
       dimension6: {{dimension6}}
     }
     ]);

```

If it still fails: did you make sure (in preview for example) that the {{dimensionX}} variables and others like {{Category}} and {{Action}} really contain values? You could try constant values instead of variables, too. Instead of implementing the changes, you can send the pushes in your browser´s console for faster feedback.

The Tracker Debugger should then help when you send broken events (they will show up there, along with an error message that indicates what is missing).

If they arrive there, you can inspect the raw data (hover over the “Custom Event” to get a link to the raw request). You should find your parameters and dimensions there if everything is okay:

![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/75af2ffbc4b76233a3ba847fdc1f69be276dceba.png)

EDIT: Your second attempt to set the dimension values before sending an event fails because of a missing “]” at the end. If you fix that and then send the event without dimension parameters, the result will match the first option to send them along with the event.

best,  
Markus

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [August 10, 2022, 10:38am UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892/3 "2022-08-10T10:38:02Z")

</div>

To confirm what Markus said, that would be the message shown in the tracker debugger:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/9fdd5082966810ddfa9c044686604867fa758531.png)

---

<div class="post-metadata">

**Author:** ![lisa](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@lisa](https://community.piwik.pro/u/lisa)\
**Post date:** [August 10, 2022, 11:58am UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892/4 "2022-08-10T11:58:28Z")

</div>

Hi all,

Thank you very much for your help ! In fact, I when I put a 0 value it works !

---

<div class="post-metadata">

**Author:** ![lisa](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@lisa](https://community.piwik.pro/u/lisa)\
**Post date:** [August 10, 2022, 11:59am UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892/5 "2022-08-10T11:59:56Z")

</div>

Concerning the place to put the code :

```auto
_paq.push(['setCustomDimension', 2, {{dimension2}})

```

I can put it where I want before the event tag ?

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [August 10, 2022, 12:31pm UTC](https://community.piwik.pro/t/setting-custom-dimension-value-for-a-custom-event/892/6 "2022-08-10T12:31:02Z")

</div>

Yes. Just make sure that it has been set before executing `trackEvent`. Also make sure to fix the typo Markus mentioned.

Note: it’s a deprecated method. I’d recommend using `setCustomDimensionValue` instead. Docs available [here](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html#setCustomDimensionValue).
