I am currently working on a method to detect if ghostery is preventing google doubleclick ad scripts from being loaded. I prefer not to use a listener and instead want a straightforward way to determine if the script or URL is being blocked. Although the code I have devised consistently leads to errors, I am able to distinguish between the different error messages. I am hopeful for a more effective solution than relying on a faulty ajax call.
My objective is simply to track the number of users who are not seeing ads due to having an ad script blocker enabled.
$.ajax({
url: 'http://www.googletagservices.com/tag/js/gpt.js',
type: 'GET',
error: function(d) {
console.log('error', d, '/error');
if(d.statusText != 'error') {
console.log('ghostery enabled');
} else {
console.log('script is not blocked');
}
}
});