Here’s a simple question:
If I have two Page Load Rules setting the same variable, and if both rules fire, which one wins?
I might have a standard PLR that fires on every single page of my site. This rule might use the URL of the current page to compute some kind of page name. This page name is then written into
(Note: while this is not recommended, it happens quite a lot in practice.)
Another rule — say one specific for product detail pages — sets
s.pageName according to a slightly different algorithm.
This is a fairly common scenario.
“Hierarchical rule sets”, in which some data is processed the same way everywhere, while other rules cover more specific cases, is one of the normal ways to deploy Analytics using Tag Management Systems.
Do we know?
When I was asked this question for the very first time, I thought “well, there’s obviously going to be an order, right?!”, hoping there would be one. Nothing is worse than non-deterministic behaviour when you want to program…
So is there? Does DTM follow some order when it works through the rules it has to fire? And is that order always the same?
And so there is our answer: the rules are stored in alphabetical order,
and DTM executes them in that order, too.
No, sorry, scratch that…
The rules are stored in alphabetical order, and when DTM traverses them to see which one to execute, it does so in the same order.
Wow, that was a short post, wasn’t it? Finally a simple answer to a simple question!