Custom dimensions with GTM

Hi guys, I’m looking to get custom dimensions to work with GTM.
I’ve been setting them in GTM (see screenshot)

All seems ok in Piwik pro as well
Screen Shot 2023-07-20 at 5.07.01 PM

But I only get undefined as the dimension value.
Screen Shot 2023-07-20 at 5.08.20 PM

Can someone help?

Hey! Are you sure that the variables set in GTM are working properly?
The method you are using is correct.

Hey Michal,

I fixed it by putting things in this order:

  1. Piwik tracking code

  2. Datalayer values

  3. Custom dimensions

My mistake was to fire custom dimensions via GTM before info was passed to the datalayer. So the custom dimensions sent were empty. Now it all works.

By the way, it looks like a Piwik feature called dimension value grouping helps creating custom dimensions without going through the datalayer option. Smart.

1 Like

Hello @Jerome

Are you sure that the tag with the setCustomDimensions needs to be send after Piwik Tracking Code ?

Because I saw in Piwik documentation this sentence : "This function does not send any data to the Tracker. It prepares a custom dimension to be sent with following events, e.g. page view, e-commerce events, outlink or download events.

And for me the Piwik tracking code is sending the pageView event automatically so if I understand well, I need to place it after the customDimensions.

Thanks for your answer !
(Je parle francais)