I am looking for the best practice with Tealium. And also to find out if there is there a way to configure utag.js. Configure it in a manner to not take control over window.onerror and allow the client to implement utag.js's error handler? My code currently works as such:
// utag.js loads and updates window.onerror.
// my scripts
var oldOnError = window.onerror || function(){};
var myOnError = function ( errorMessage, url, lineNumber ) {
// handle error for client reporting };
// update window.onerror
window.onerror = function ( ) {
var args = Array.prototype.splice.call( arguments );
// run my error handler
myOnError.apply( window, args );
// run previously set error handler
oldOnError.apply( window, args );
};
But, I feel it would be good practice for utag.js to not take over window.onerror based on a configuration. The implementation could look like this:
window.utag_cfg_ovrd= { no_onerror: true };
window.onerror = function ( ) {
var args = Array.prototype.splice.call( arguments );
// run my error handler
myOnError.apply( window, args );
// run utag's onError handler
utag.onError.apply( window, args );
};
Thanks, Drew
... View more