# Combining variables in Custom Event fields

**URL:** <https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239>\
**Category:** Data collection and tags\
**Created:** [May 17, 2023, 8:20am UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239 "2023-05-17T08:20:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikkovai](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mikkovai/32/1881_2.png) [@mikkovai](https://community.piwik.pro/u/mikkovai)\
**Post date:** [May 17, 2023, 8:20am UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/1 "2023-05-17T08:20:21Z")

</div>

Hi there,

Is it possible to combine Piwik variables in Custom Event Action or Name? It’s been quite common to do this in UA, when you need to have several data points in one field.

I tried this in a couple Custom Event tags and got a “0” in the reports.

![Screenshot 2023-05-17 at 11.18.00](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/a/abd3fa03a8632e47707efc42782fc3e81a043553.png)

Or are Custom Dimensions the way to go?

---

<div class="post-metadata">

**Author:** ![anthonybartczak](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/anthonybartczak/32/2430_2.png) [@anthonybartczak](https://community.piwik.pro/u/anthonybartczak)\
**Post date:** [May 17, 2023, 8:28am UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/2 "2023-05-17T08:28:12Z")

</div>

Hi mikkovai!

It’s currently not possible to combine 2 different Piwik PRO Tag Manager variables in one field.

You could either:

1. Create a Custom JS variable that joins both of these variables into a single string and then use it in the _Name_ field.
2. Create a custom dimension to store the additional variable information.

---

<div class="post-metadata">

**Author:** ![mikkovai](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mikkovai/32/1881_2.png) [@mikkovai](https://community.piwik.pro/u/mikkovai)\
**Post date:** [May 17, 2023, 8:30am UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/3 "2023-05-17T08:30:19Z")

</div>

Thanks! CJS FTW then 🙂

---

<div class="post-metadata">

**Author:** ![gonerator](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/gonerator/32/3549_2.png) [@gonerator](https://community.piwik.pro/u/gonerator)\
**Post date:** [May 17, 2023, 1:34pm UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/4 "2023-05-17T13:34:12Z")

</div>

@mikkovai it is possible to do that with “+”, like so:

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

Result:

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

I hope it helps, cheers!

---

<div class="post-metadata">

**Author:** ![anthonybartczak](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/anthonybartczak/32/2430_2.png) [@anthonybartczak](https://community.piwik.pro/u/anthonybartczak)\
**Post date:** [May 17, 2023, 1:59pm UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/5 "2023-05-17T13:59:35Z")

</div>

Hi gonerator!

Just FYI - it works as of now but it might not work in the future in case we decide to change how the fields are being parsed.

---

<div class="post-metadata">

**Author:** ![gonerator](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/gonerator/32/3549_2.png) [@gonerator](https://community.piwik.pro/u/gonerator)\
**Post date:** [May 17, 2023, 2:07pm UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/6 "2023-05-17T14:07:09Z")

</div>

Good to know, thanks! I still rather use custom js 🙂

---

<div class="post-metadata">

**Author:** ![Serena](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Serena](https://community.piwik.pro/u/Serena)\
**Post date:** [May 30, 2023, 6:47am UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/7 "2023-05-30T06:47:54Z")

</div>

Hi,

as someone wrote, either you store them in a Custom JS or you write in a i.e. notepad the variables you need in the same structure you need to get them in action or name and then copy-paste in the action/name field. For instance write down "{{ DLV var1 }} | payment card:{{ var2 - Custom JS }} | {{ DLV var3 }} and then copy them in the field.  
In our case it works fine and that also was the Piwik’s recommendation.

---

<div class="post-metadata">

**Author:** ![mikkovai](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mikkovai/32/1881_2.png) [@mikkovai](https://community.piwik.pro/u/mikkovai)\
**Post date:** [June 6, 2023, 1:23pm UTC](https://community.piwik.pro/t/combining-variables-in-custom-event-fields/2239/8 "2023-06-06T13:23:55Z")

</div>

So you got it working without the “+” sign between the variables?
