Advanced Debugging of IQ using Charles Proxy

Tealium Employee

Using Charles Proxy here is a way to get more advanced output from utag.DB.

 

A sample for the output with this enhanced output.

 

enhanced DB.png

 

Using the Charles rewrite functionality (https://www.charlesproxy.com/documentation/tools/rewrite/)

 

Rewrite.png

 

The 2 body rewrites looks like this:

 

Rwrite.png

 

The code to use in each are:

 

First to upgrade the utag.DB function:

 

Match Value

;utag.o['

   

Replace Value

; 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[' 

 

Second to add extra utag.DB calls to try/catches

 

Match Value (Regex):

\}catch\((.*?)\)\{

 

Value Match: 

}catch($1){utag.DB($1);

 

 

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Public