Messing with .push

Example of how GA async messes with the push method of an array

by Ronny

JavaScript

var a = [];
a.push(['omg']);
a.push(['this is'], ['so cool']);

// later, from the file
report = function(rep){
    console.info('Reporting', rep);
    // new Image(report[i]
}
// empty queue
a.forEach(function(rep, i){
    report(rep);
});
// replace push method
a.push = function(){
    report(arguments);
};

// now a.push fire reports instead of pushing to the array
a.push('another one');