Integer Event/Product Custom Dimenson

Hey! :slight_smile:

We are using a custom event to track add-to-cart and we added all the dimensions that we needed however I now see that they are all strings…
Is it not possible to add custom integer or float dimensions?
Some are like price, quantity and product position on the grid and we would like to then do custom metrics using them :frowning:
Should I not use custom dimensions? Is there another way?

Thank you so much!
Kind regards,
Marta

Hi there!

Welcome to our community :smile:

Unfortunately, right now it’s not possible because custom dimensions are stored as a string. We would need to add a numerical type of custom dimensions, which is not on the roadmap currently.

The parameters you mentioned (price, quantity, position) could be implemented as numbers through data layer. Did you look into our article about setting up ecommerce? It might be helpful in your situation and it’s fairly simple to set up with our new ecommerce tag templates :smile:

Hey! :slight_smile:

Thank you for your answer! I already have all the ecommerce events on the data layer however those events have extra dimensions (stored as numbers) that are not included in the ecommerce tag template :frowning:

For example,

Is it possible to add extra dimensions to the ecommerce tag template? That would help a lot :smiley:

Thank you!
Kind regards,
Marta Azevedo

Hi,

Our tag templates don’t have that implemented yet, but there are ways you can make this work :smile:

If you want to keep the ecommerce tags, you could make a second tag (a custom dimension tag) for setting the dimensions, and set the priority so this second tag fires before the ecommerce one.

Another way would be to not use the ecommerce tag templates and set up a custom code tag instead, where you send the event manually (code is available in our solution templates) with the custom dimensions. Here is an example from our developer docs:

_paq.push([
    "ecommerceAddToCart",
    [{
        sku: "craft-311",
        name: "Unicorn Iron on Patch",
        category: "Crafts & Sewing",
        price: "49.90",
        quantity: 3,
        brand: "DMZ",
        variant: "blue",
        customDimensions: {
            1: 'coupon-2020',
            2: '20%'
        }
    }]
]);

Hi! :slight_smile:

For the Custom Dimension tag solution:
→ Can those dimensions be numbers? Or do they have to be strings?

For the Custom Ecommerce Tag:
→ Can those customDimensions be numeric?
→ In the example, the custom Dimension is at product level. Is it possible to also have custom dimensions at event level? Of is it better to them in another custom dimension tag?

Thank you so your help!
Kind regards,
Marta

Hi,

Both of these solutions still use custom dimensions that only store data as a string, so that can’t be changed. If you want to have those dimensions at a event level - it would be better with the custom dimension tag solution :smile:

Hey :smiley:

Just to check, the “best” solution for this case would be:
→ to have a custom Ecommerce Tag (with the custom dimensions on product level) and a custom dimension tag for the event level dimensions?

Thanks!
Kind regards,
Marta Azevedo

Yes, for your case it would be the best way to go. Also, keep in mind that when you use an event dimension and track it with a custom dimension tag, you need to run this tag before the tracking code (Piwik PRO tag). This is because a custom tag needs to send data before a page view is tracked.

Here is an article explaining how to set and use the custom dimension tag: Custom dimension tag | Piwik PRO help center. And here is an article on tag priority: How to fire tags in a specific order | Piwik PRO help center.