Detect if your ad is iframed in pop network

meannn

Elite Member
Joined
Apr 22, 2009
Messages
1,908
Reaction score
2,771
So some bad players (mostly publishers) use hidden iframes on the page like 1x1px which users don't even see. To detect that, just put this code in your ad page and now you will see who are the bad players. You just need to be at least beginner in coding. This code also gets the publisher ids.

Lets say your ad is mysite.com/ad.php?zoneid={zoneid}
(zoneid can change from different pop networks, just change to their type)

In your ad page, add this;

(function () {
var inFrame = true;
try { inFrame = (window.self !== window.top); } catch (e) { /* cross-origin: still iframed */ }

if (!inFrame) return;

// Simple beacon (no CORS issues). Add whatever query params you want.
new Image().src =
'https://mysite.com/badplaterdetect.php?id=<?php echo $_REQUEST["zoneid"] ?>'
+ '&u=' + encodeURIComponent(location.href)
+ '&r=' + encodeURIComponent(document.referrer || '')
+ '&t=' + Date.now(); // cache-buster
})();



And in your badplayerdetect.php, add this so it creates publisher ids automatically add ids to your server directory. So at the end of the day you will see bad player ids and block them on the pop network.

$badid = $_REQUEST["id"];
file_put_contents($badid.txt', "Bad guy detected\n");
 
Back
Top