This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Intercept all the HTTP requests and inject a tracker if the payload is JSON | |
!function() { | |
XMLHttpRequest.prototype._original_send = XMLHttpRequest.prototype.send; | |
let interceptor_send = function(data) { | |
try { | |
obj = JSON.parse(data); | |
obj._tracker = 'tracker_id'; | |
let new_data = JSON.stringify(obj); | |
this._original_send(new_data); |