- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hi All,
Can someone please explain me what does utag.hanlde.extend= [function(a,b){}] does in utag.js
Solved! Go to Solution.
utag.handler.extend is an array of functions that contains your All Tags extensions (Before Load Rules, After Load Rules and After Tags).
Each item in the array follows this structure:
function(a, b){ try{ if(conditions){ ... your extension code ... } } catch(e){ utag.DB(e); } }
If you defined additional scope variables in the TIQ interface, they follow a, b in the initial declaration of the function. If your extension has no conditions, it's wrapped in an if(1){...} block, which tends to get optimised out entirely in the process of minification (since it always runs).
This is then paired with utag.handler.cfg_extend, which is an array of the same length, whose nth item defines the configuration settings of the nth item in the extend array.
Each entry in utag.handler.cfg_extend defines the execution window in which the extension runs (defined by whether "blr", "alr" or "end" are set to 1), as well as the ID of the extension in question, and a count of how many times it has run. If the object has a property "once" set to 1, then extensions won't run again if their count value has reached 1 (enabling the "run once" option).
The order of the extensions in the array is the order in which they're executed, which should ideally align to the order in the TIQ interface.
Copyright All Rights Reserved © 2008-2023