DTM -Set load order of rules

oliver_schiffer

15-10-2015

We are facing some issue regarding the page load rules.

Below are the steps we followed:
. We created 2 page load rules, and set them to Trigger at "Top of page".
. In one rule we added "Sequential Javascript" and in the other we added "Non sequential Javascript".

As per DTM documentation, the expectation was "Sequential Javascript" code should have always executed before the "Non sequential javascript".
However, this is showing random behavior, sometimes the sequential javascript rule gets executed before the non-sequential javascript rule; and sometimes the non-sequential javascript rule executes first.

What we want to achieve here is to always execute a "Rule 1" first before another "Rule 2". We are creating these rules to trigger at "Top of page".
Even if we create both the rules with "Non-sequential javascript", is there any way we can set the order of the rules so that one rule always fires before the other rule.
In other words, in what order does DTM will execute 2 rules to be triggered at "Top of Page".

Accepted Solutions (1)

Accepted Solutions (1)

Ben_Bytheway

Employee

15-10-2015

In other words, this is the section you are interested in:

The dynamic tag management queue processes them in that order but does not distinguish between a JavaScript or an HTML script within the page load phase.

This means that the order of the page load rules within the queue determines the order in which they are dequeued.

A simple way to determine the queue order is to look at _satellite.configurationSettings.pageLoadRules in the JavaScript console and examine the sequence.

For example, a complete view of the page load rule queue order can by seen by entering the following code into the JavaScript console:

_satellite.each(_satellite.configurationSettings.pageLoadRules,function(i){(i.event=='pagetop')?_satellite.notify(i.event+': '+i.name,1):false}) _satellite.each(_satellite.configurationSettings.pageLoadRules,function(i){(i.event=='pagebottom')?_satellite.notify(i.event+': '+i.name,1):false}) _satellite.each(_satellite.configurationSettings.pageLoadRules,function(i){(i.event=='domready')?_satellite.notify(i.event+': '+i.name,1):false}) _satellite.each(_satellite.configurationSettings.pageLoadRules,function(i){(i.event=='windowload')?_satellite.notify(i.event+': '+i.name,1):false})

I have found that DTM will order them by alphabetical order and it will fire then in descending order, but I don't know that this is guaranteed to always work that way.  Because of this currently, I have used a naming convention of "~ 9 some name" will fire first, "~ 8 some name again" will fire second, etc.

My suggestion is to follow the instructions above and play around with page load order to figure out what changes to the name of the rule will do to the order of the rule.  🙂 

Ben

Answers (5)

Answers (5)

Ben_Bytheway

Employee

15-10-2015

Hey Oliver,

I should clarify one thing.  When I mentioned that I have noticed that alphabetical order will determine the order in which rules are fired, I should clarify that I have seen this behavior with coding the script in a "Sequential HTML" rule.  I have always gotten pretty consistent results with sequential HTML across rules in alphabetical order.  "Sequential javascript" and "non-sequential javascript" haven't been as consistent though.  Sequential javascript within the same rule should fire in the order specified within the rule, but not necessarily across rules.  Non-sequential javascript does not guarantee any order within the rule or across rules.

Thanks,

Ben

oliver_schiffer

15-10-2015

Sure. We are testing your options and will let you know.

The other answer seemed to be a misunderstanding, not to the point I tried to make.

Best, Oliver

Ben_Bytheway

Employee

15-10-2015

You are welcome!

Will you mark one of the answers correct so that on-comers to help-forums will be able to quickly find answers to their questions!

Thanks,

Ben

shekhardhiman

Employee

15-10-2015

Hi There,

Thank you for reaching out to Adobe Community.

You can refer to the Load Order for Rules doc to see the load order of rules. To set where the page load rule fires on a page refer to Create conditions for page-load rules doc.

Thanks!