Hi Anitha,
The delay that you're experiencing is not due to the "Rule Order" (rule order is only effects a process within a single trigger - you are using two different triggers: DOM Ready, and Direct Call('value') ). Instead, the strange delay is actually due to the cascading effect of using a Custom Code Action Block via postscribe to initiate the Direct Call. (in order for the code to execute, it may be further delayed by other things happening in the window (since you doing all this prior to onLoad).
Because your current DOM Ready rule does not have a trigger of Page Top or Page Bottom, the custom code for the action block is not embedded in the library itself, you are seeing the results of using postscribe to execute the custom code. It's also important to know that this code is executed outside of the timing control of Launch (meaning other Rules and Actions may happen before this postscribed code fully completes, yikes! ).
There's no way I could explain it better than Aaronius9er9er9er : So I'd recommend reading his post to grasp how and when postscribe is used. (link below)
Re: Load Order for Rules :: DTM vs. Launch
Possible solutions:
You have a few options to eliminate the postscribe inefficiency:
Option 1 (if you want to continue using the direct call)
Take your custom code, and place it inside the setVars action block -> custom code area. This will ensure that your direct call can execute as soon as the variables have been set, without requiring the postscribe methods.
Option 2 (If you want to utilize Rule Order and standard Launch Trigger procedures)
- Have your first Rule on DOM Ready set the variables
- Make a second Rule also have the trigger of DOM Ready for sending the beacon. And then give it a Rule Order value greater than the first.
(This method works because DOM Ready is the same trigger used for multiple rules. It will initiate both of the rules, but do them in the correct "Rule Order")
Example of how this works:
"MyPage SetVars Rule" - DOM Ready Trigger (rule-order-01) - actions: setVars
"MyPage SendBeacon Rule" - DOM Ready Trigger (rule-order-02) - actions: SendBeacon + clearVars
Option 2 (if you can execute all actions from within the same rule)
Use your DOM Ready Rule for everything. Have a setVars action block, followed by a sendBeacon, followed by anything else you need.
Option 3 (i personally don't recommend it, but it would work)
If your rule had a trigger of Page Bottom instead of DOM Ready, then the code would be included in the library itself, and not need to make use of postscribe to execute.