Support data layer variables that read and element from an array?

Hello dear community,

We just wanted to switch from GA4 and Google Tag Manager to Piwik Pro with several projects. But now I am a bit irritated, because it seems that the Piwik Pro tag manager does not support data layer variables that can read a value from a data layer array.

Example Data Layer

   "event": "view_item",
   "ecommerce": {
      "currency": "EUR",
      "value": 3500,
      "items": [
            "item_id": "12345",
            "item_name": "Name",
            "item_category": "C1",
            "item_category2": "C2",
            "item_category3": "C3",
            "item_category4": "C4",
            "item_category5": "C5",
            "item_variant": "F/S",
            "price": 3500,
            "quantity": 1

If I now want to read a certain value from the array, e.g. “item_name”, my normal procedure would be to create a data layer variable that queries “ecommerce.items.0.item_name”. Am I doing something wrong or is this really not supported?

We have almost 70 data layer events containing arrays, do we really need to write a custom java script for each of these data layers?

1 Like

Hi. Yes, it’s not supported now but it’s on our short term roadmap. To make the transition faster, you can use a custom js variable. There you can use variable inside variable, so getting to the nested values shouldn’t be a big issue.

For instance, you can create a variable {{ ecommerce }} and then another custom js variable that is defined as {{ ecommerce }}.value.