DataLayer variables & TMS

I have a problem in the data feedback on the Piwik pro tool. I determined on my DataLayer a PageCategory key. Sometimes Piwik pro captures the value sometimes not, as you can see in the attached table.
it’s not just about specific urls. It’s very random.

I wonder what is the reason? Because today the result is a completely toothless dashbord as you can see in the attached screenshot.

Regarding the trigger, I chose SPA with the trigger conditioning that you find in the screenshot below.

Could you please enlighten me on this issue specifically? Thank you for your time.

Just quickly checked your setup and:

  • virtual page views tracking works correctly, because there’s by default this delay of 1 sec. Note, your using the built-in SPA tracking that is enabled in Administration → Your Page → Data collection
  • standard page views (full reload) sometimes fire when the variable is not set (yet). Currently, you’re using the default Piwik PRO tag and its trigger doesn’t check if the variable is set. It can be easily reproduced by disabling cache in the browser’s console


BTW. I also noticed, that your website generates sometimes an additional history change event which results in generating a redundant page view. This is what happened after I fully refreshed the page. In this context, only the Piwik PRO tag should fire (scroll events are also fine since I scrolled to 75% before refreshing).


There’s also a video showing how to reproduce the issue: link

Thank you for your remarks. But I do not see what is the solution that I can adopt to correct this anomaly!
What should I use as a trigger?

How should I configure the Tag Piwik Pro (page view) so that it does not trigger before the variables are filled in?
What can you recommend me about this?
Thank you for your time.

In my opinion the most reliable solution is to check how your current website / CMS works. I’d make sure that the datalayer is available always at the right time, even when there’s no cache. Website shouldn’t behave differently depending if it’s the first or second page view.

Other thing to check is the history change event generated in some cases on first page view. It’s also something to check by the frontend developer that works on the website.

Can I first give you access to the TMS tool so that you can check if the settings are correct?

I can already see based on the tag manager debug mode that it’s correct. It’s more about the website. You could maybe change the default all pages trigger to something that loads a bit later. E.g. switching from page view to page load, but not sure if that would help.

Also, this won’t solve the issue with redundant page views.

The default all pages trigger is already configured like this.

It wasn’t set so yesterday. It should improve the situation with the page category, but most likely won’t cover all use cases. You can check it tomorrow and compare with previous data.

Do you have some kind of guide or best practices to adopt for setting up a DataLayer?

It should be defined in the page source as high as possible, assuming you have access to the needed data at this point.