Skip to content

Instantly share code, notes, and snippets.

@tommyh
Last active November 13, 2015 18:50
Show Gist options
  • Save tommyh/ae29b5d54c88564c8ba6 to your computer and use it in GitHub Desktop.
Save tommyh/ae29b5d54c88564c8ba6 to your computer and use it in GitHub Desktop.
<h1>IAS: Pixel Tracking Debuger</h1>
<p>This page provides a bookmarklet to help debug the IAS tracking pixels.</p>
<h3>Usage</h3>
<ol>
<li>Install the bookmarklet by dragging the link below into your bookmarks bar</li>
<li>Go to a page which has a video player on it where IAS verification is in use</li>
<li>Click the bookmarklet</li>
<li>You should see 9 red squares appear - these are the IAS tracking pixels</li>
<li>You might see a the video player get a white halo around it. This will happen when the bookmarklet finds a script tag with the source of http://pixel.adsafeprotected.com/jload, and then it puts a border around the scripts parentNode.</li>
</ol>
<h3>Bookmarklet:</h3>
<p>
<a href="javascript:(function()%7Bvar%20iasPixels%20%3D%20document.querySelectorAll(%22object%5Bdata%3D'http%3A%2F%2Fstatic.adsafeprotected.com%2Fdetector_4_0.pix'%5D%22)%3Bfor(var%20i%3D0%3B%20i%20%3C%20iasPixels.length%3B%20i%2B%2B)%7Bvar%20iasPixel%20%3D%20iasPixels%5Bi%5D%3BiasPixel.style.width%20%3D%20%2210px%22%3BiasPixel.style.height%20%3D%20%2210px%22%3BiasPixel.style.zIndex%20%3D%20%22110%22%3BiasPixel.style.opacity%20%3D%20%22initial%22%3BiasPixel.style.border%20%3D%20%225px%20solid%20red%22%3BiasPixel.style.boxShadow%20%3D%20%220%200%2010px%20%239ecaed%22%3B%7Dvar%20scripts%20%3D%20document.getElementsByTagName(%22script%22)%3Bfor(var%20i%3D0%3B%20i%20%3C%20scripts.length%3B%20i%2B%2B)%7Bvar%20script%20%3D%20scripts%5Bi%5D%3Bif(script.src%20%20%26%26%20script.src.substring(0%2C38)%20%3D%3D%3D%20%22http%3A%2F%2Fpixel.adsafeprotected.com%2Fjload%22)%7Bscript.parentNode.style.boxShadow%20%3D%20%220%200%2050px%20%239ecaed%22%3B%7D%7Dif(iasPixels.length%20%3D%3D%3D%200)%7Balert(%22Error%3A%20No%20IAS%20Tracking%20Pixels%20were%20found!%22)%3B%7D%7D)()">IAS: Pixel Tracking Debugger</a>
</p>
<h3>Source code for the bookmarklet</h3>
<pre><code>
var iasPixels = document.querySelectorAll("object[data='http://static.adsafeprotected.com/detector_4_0.pix']");
for(var i=0; i < iasPixels.length; i++){
var iasPixel = iasPixels[i];
iasPixel.style.width = "10px";
iasPixel.style.height = "10px";
iasPixel.style.zIndex = "110";
iasPixel.style.opacity = "initial";
iasPixel.style.border = "5px solid red";
iasPixel.style.boxShadow = "0 0 10px #9ecaed";
}
var scripts = document.getElementsByTagName("script");
for(var i=0; i < scripts.length; i++){
var script = scripts[i];
if(script.src && script.src.substring(0,38) === "http://pixel.adsafeprotected.com/jload"){
script.parentNode.style.boxShadow = "0 0 50px #9ecaed";
}
}
if(iasPixels.length === 0){
alert("Error: No IAS Tracking Pixels were found!");
}
</code></pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment