How can we track Custom Dimensions with Consent and other automatic Piwik Events?

We have multiple Event-level Custom Dimensions. One to track the content language or content region. It is set on all pageviews and all Custom Events, so everything I can control via the TM gets the values. However, the client is highly confused that when they e.g. break down their campaigns by Subfolder, they also see “No data” quite a lot:

The reason are Piwik’s those “orphaned” events like “Consent Form Impression” or its automatic “Scroll” Events which we cannot influence, i.e. we cannot put Custom Dimensions in these events. Or can we? We can also not configure the Piwik Site so these Events never end up in the reports (we don’t need them, but I think the Consent Events should be reported in a separate bucket to avoid nonsense like this).


While we will probably deactivate Piwik’s automatic scroll Events due to this, it does not seem like there is any way to set Custom Dimensions for Consent Impressions or Decisions (because the Consent Decision happens before the Pageview). Or is there one?

Hi @loldenburg,

When it comes to making sure that all events have assigned the custom dimension value, you just have to make sure that custom dimension tag is the first one that fires on each page (or if you are using js methods then this line should be fired before any tracking API — Piwik PRO Analytics Suite 18.12 documentation).

About having split for event type. You can use dimension value grouping to create a group for Consent Events and all the rest as well as using filters per report to remove unwatned events.

You could also add a filter that removes all events that have value for those dimensions set to empty


Thanks, but why would I need a separate tag just to set custom dimensions if I already configure all the default dimensions in the Piwik Pro Config Tag?? Makes absolutely no sense to me.
Does that mean I effectively have to build the whole Custom Dimension configuration twice?

And is there any way to order the dimensions by their index? Seems not. Gets totally messy if you have more than just a couple of dimensions…


Hi @loldenburg,

You don’t need to build it twice, you can add the custom dimensions as a separate tag. If you do so, you don’t need it to setup for each individual event or pageview.
If you set it before any other tag, it will be use for all events that will be send throughout the same page view, until you push new values to the TM variables, or load another page / reload the page, making the Custom dimension tag fire again.

You can alter the default setup almost anyway you please, but since you are making it custom, you have to make it consistent all the way.

Custom dimensions set, will be available throughout the same page view or session (in case of session custom dimensions, that is), until you change or empty them.

This feels conceptually misguided. Why is there a “Basic Tracking Code” Tag (i.e. a config tag) with seemingly “global” (=for all events) Custom Dimensions to set if we need yet another tag if we want Custom Dimensions to also be valid for some Events that Piwik TM fails to connect to this “basic tracking code” tag?

“You can alter the default setup almost anyway you please, but since you are making it custom, you have to make it consistent all the way.”
In what sense am I making it “custom”? What is “custom” (i.e. “not according to the standard”) about wanting Custom Dimensions to be set for all Events to not have garbage in the reports?

@Oliwer_Kaczmarek I tried this now btw, but the Consent Impression Event is still always “naked”, i.e. no Custom Dimensions are getting set. I am using a prioritized “Custom Dimensions” tag which loads on pageView (“begins to load page”).

If tags are fired before this basic tag, these things happen.
There can be many reasons for it. In most cases they can be solved by setting it up by prioritisation of the tags.

The provided solution is imho the best way to take care of it.

@rmastop But it does not work, or do you get Custom Dimensions for your Consent Impression Events? I have the Custom Dimension Tag prioritized. For the Consent Manager Impression, there is no “Tag”, Piwik fires it automatically, so I don’t see how I could influence this in any way…

I want this Consent impression data to disappear from the Analytics data because it spams all reports with “No data”, or I need a way to set custom dimensions for it.

If you don’t want these events, you can exclude them by setting a filter event type is not

Or if you need your report to be limited to custom events, set is as event type is

Would that help in your case?

Of course I know I can do that, but telling the client to do that every time they want to a 2dimensional report is absolute bonkers.

By the way, I just confirmed in my setup. The consent impressions show up having custom dimension values.

But only if these custom dimensions have a value. e.g you want to use the value of a URL parameter, but the URL parameter does not exist, the value will be empty.

Should your custom dimension have values all the time, or can they be empty as well?

Thanks, that gives me some hope. Most of the CDs in my case should always have values. E.g some are derived from the URL - which cannot NOT exist. Can you show me exactly what you do so I can understand where my setup differs?
And we are talking about the very first consent impression, right? Not one where the user is already on the page and manually resurfaces the Consent form?

Indeed, it is the very first pageview.
Added a tag of type Custom dimension:

connected to trigger Page view

Prioritized it to be triggered first:

My Piwik PRO tag has no changes.

when I navigate to the site, these events are triggered in this order:

Since the set path to dimension is triggered first, all scripts triggered afterwards have the same value, until I override the custom dimension in another tag, or reload the page.

1 Like

Ok thanks, my CD Tag Consent Settings were set to “Analytics”. I swear I saved them as “No consent required”, but PP Tag Manager recently tends to reload every minute or so without me doing anything (is this a common bug?), that probably reset the Consent setting, and when I then saved it, it got saved with the Analytics consent setting again.

While this indeed works, I think it is highly unintuitive because the “Basic Tracking Code Tag” should be the one that sets all the default Custom Dimensions no matter the Event. And the confusing thing is that it also does that, but Consent and Scroll Events seem to not care about that. Piwik Pro needs to straighten that out.

1 Like