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
Should I not use custom dimensions? Is there another way?
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
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
Our tag templates don’t have that implemented yet, but there are ways you can make this work
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:
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?
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
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?
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.