- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog TLC Blog
- Support Desk Support Desk
This article will show how to use Charles Proxy to obtain more advanced output from utag.DB. By adding a rewrite setting to Charles Proxy, the regular errors from utag.DB will be displayed as a browser level console warnings. This allows for the Warnings filter in the console to be used when filtering errors, warnings, and info output.
/*/utag.js
For the Match section, place in the Value field
;utag.o['
For the Replace section, place in the Value field:
; utag.ut.typeOf = function(e) {return ({}).toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase();}; utag.DB = function(a, b) { var t; if (utag.cfg.utagdb === false) { return; } else if (typeof utag.cfg.utagdb == "undefined") { utag.db_log = []; b = document.cookie + ''; utag.cfg.utagdb = ((b.indexOf('utagdb=true') >= 0) ? true : false); } if (utag.cfg.utagdb === true) { var con = window.console; if (utag.ut.typeOf(a) === "error") { utag.db_log.push(a); t = ""; if (a.stack && a.stack.split) { t = a.stack.split("\n")[1].replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '').replace(/^at\s/, ""); } if (con) { t = "utag - Error : " + t + " "+ a.message; if (con.warn) { con.warn(t); } else if (con.log){ con.log(t); } } } else { t = (utag.ut.typeOf(a) == "object") ? utag.handler.C(a) : a; utag.db_log.push(t); if (con && con.log) con.log("utag - ", t); } } };utag.o['
For the Match section, place in the Value field
\}catch\((.*?)\)\{
For the Replace section, place in the Value field
}catch($1){utag.DB($1);
The "uTag DB Upgrade" set with the two included rewrites should look like this when complete:
Below is a sample of the enhanced output as shown in Google Chrome DevTools. You can see that instead of just showing as Info output, the error is showing as an expandable warning, which can be filtered by selecting the Warnings option in the dropdown next to the Filter input box.
Copyright All Rights Reserved © 2008-2021