Ecommerce Broken event when using GA4 dataLayer as source

Hi,
I created the new ecommerce events in the tag manager of Piwik per the guide (Ecommerce add-to-cart tag | Piwik PRO help center).

But in the debugger I am seeing:

Broken event

Error message: Tracking parameter `ec_products` has invalid value. Unable to deserialize ecommerce products JSON: invalid type: integer `39919`, expected a string at line 1 column 7

The event itself shows:
"ec_products": "[[39919,\"test product\",[\"item\",\"item category\"],149,1,\"\",\"classic\"]]",

Looking at the full event in the Datalayer I see both item_id and id. Where id is a string.

{
  "event": "add_to_cart",
  "ecommerce": {
    "currency": "EUR",
    "value": 169,
    "items": [
      {
        "item_id": 39910,
        "item_name": "test product",
        "item_brand": "",
        "price": 169,
        "item_category": "item",
        "item_category2": "item category",
        "item_variant": "classic",
        "quantity": "1",
        "google_business_vertical": "retail",
        "id": "39910"
      }
    ]
  },
  "gtm.uniqueEventId": 30
}

Is there a typecast that I should create, or is this on your end?

Hi there!

The GA4 preset in ecommerce tags automatically assigns “item_id” to the id field and the parameter accepts only string values. As you can see, in your case, “item_id” is a number and “id” is a string.

So if you use our ecommerce tags, you should change “item_id” to “id” in the field and that should fix the broken events :smile:

Thanks! It is fixed.