Missing http-referrer for img tracking pixels on iOS
Type of issue
[x] Bug ?
Description
During tests on iOS we've noticed that http request for tracking pixel in rendered creatives doesn't contain referrer http-header and that may cause a discrepancy in statistics. The referrer header is absent at least for Safari and Chrome mobile browsers. After some tests I've found that approach with rendering creative in iframe with iframe.srcdoc solves this issue. I beleive that this issue may affect any of ad platforms that relying on http-referrer information from theirs tracking pixels.
Here is POC that fixes this issue: /src/prebid.js:renderAd
if (doc === document || adObject.mediaType === 'video') {
utils.logError('Error trying to write ad. Ad render call ad id ' + id + ' was prevented from writing to the main document.');
} else if (ad) {
if (doc.defaultView && 'srcdoc' in doc.defaultView.frameElement) {
doc.defaultView.frameElement.srcdoc = ad;
} else {
doc.write(ad);
doc.close();
}
setRenderSize(doc, width, height);
}
Steps to reproduce
- Open http://jsfiddle.net/ckbo3hrk/u9qq2ee1/ url with Chrome or Safari on IOS
- In intercepted requests (I used fiddler with proxy option enabled in order to intercept traffic from mobile device) there is no http referrer header for http://cpm.metaadserving.com/win?i=UBY6QS45GBA_0 request
- Open http://jsfiddle.net/ckbo3hrk/baqedx28/ url (it uses an updated version of prebid.js with proposed solution) with Chrome or Safari on IOS
- Http referrer header is presented in requests as expected
Platform details
IOS 10.2.1 on Ipad Air, Chrome 56.0.2924.79, Safari 10.0, Prebid 0.17.0
Great stuff! I'm all for using HTML 5 when we can. Want to open up a PR?
How did you use a mobile device to test with fiddler? Was it emulation or a real device?
Want to open up a PR?
Once I've done some in-house tests I'll open up a PR.
How did you use a mobile device to test with fiddler? Was it emulation or a real device?
I did the tests on a real device (IOS 10.2.1 on iPad Air). I configured the fiddler on PC as a proxy then configured the ipad to use this proxy.
Very nice and important. i'm going to test .0.19 build adding srcdoc i can see how this issue is one of the major discrepancy factors.
It looks like Firefox doesn't support http referrer sending for srcdoc-placed sub-resources. Maybe we should leave the old rendering aproach for Firefox.
@ckbo3hrk Do you have an updated snippet to use srcdoc only for supported browsers ?
@mercuryyy I think the snippet above does that.
This is in master.