javascript - Ad Viewability Inside Third-Party iFrames -
so google recent acquisition of spider.io, talking ad viewability.
aside spider.io's patented technique , comscore's patented geometric technique... there other way of detecting ad viewability using javascript inside 3rd-party iframe?
thanks!
there way detect cross domain view-ability
1) request animation frame (ios). 2) intersectionobserver (api chrome, firefox etc).
both example here.
var options = { threshold: [0.0, 0.3, 0.7, 1.0]
};
var element = document.getelementbyid("element"); function intersectionobserver(callback) { function callbackobserver(entries, observer) { entries.foreach(function(entry) { callback.call(this, entry.intersectionratio == 0) }); } var observer = new intersectionobserver(callbackobserver, options); observer.observe(element); } function reqanimframe(callback) { var lastcalled; var fps; var timediff; function requestanimframe() { if (!lastcalled) { lastcalled = date.now(); fps = 0; } timediff = (date.now() - lastcalled); if (timediff <= 1000) { fps++; } else { lastcalled = date.now(); fps = 0; } callback.call(this, fps <= 10); window.requestanimationframe(requestanimframe); } window.requestanimationframe(requestanimframe); } var callback = function(isnotview) { console.log(isnotview); } //ios reqanimframe(callback); //other ios intersectionobserver(callback);
Comments
Post a Comment