- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hello,
I am trying to debug a load rules that is a conditional using userAgent.
Is there a place where I can see the load rules being loaded? I can't seem to find it. If I could find it I thought I could put a breakpoint to see what is going on.
Sincerely,
Jon_The_Boss
Solved! Go to Solution.
Hi
The easiest way to find where load rules are is to search utag.js for the condition that one of your load rules uses. Depending on the version of utag you are using, you should find code like this;
utag.loader.loadrules = function(_pd, _pc) { ... c[6] |= (d['userAgent'].toString().toLowerCase().indexOf('chrome'.toLowerCase()) > -1) ... };
You can put a breakpoint on the condition line. Note that this line may be executed more than once during the page load, and during subsequent view and link calls, depending on your set up.
Also note that userAgent is not a built in data source variable. So, to use it in a load rule, I created a Set Data Value extension for All Tags, that runs Before Load Rules, that sets the data source variable userAgent to the JavaScript snipper navigator.userAgent.
If you are running earlier than version 4.38 of utag, Before Load Rules is not available. You can do a similar thing using a Preloader extension in that case, using this kind of code;
window.utag_data = window.utag_data || {}; window.utag_data.userAgent = navigator.userAgent;
Copyright All Rights Reserved © 2008-2023