Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing http-referrer for img tracking pixels on iOS #977

Closed
ckbo3hrk opened this issue Feb 9, 2017 · 7 comments
Closed

Missing http-referrer for img tracking pixels on iOS #977

ckbo3hrk opened this issue Feb 9, 2017 · 7 comments
Labels

Comments

@ckbo3hrk
Copy link
Contributor

ckbo3hrk commented Feb 9, 2017

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

  1. Open http://jsfiddle.net/ckbo3hrk/u9qq2ee1/ url with Chrome or Safari on IOS
  2. 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
  3. Open http://jsfiddle.net/ckbo3hrk/baqedx28/ url (it uses an updated version of prebid.js with proposed solution) with Chrome or Safari on IOS
  4. 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

@mkendall07
Copy link
Member

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?

@ckbo3hrk
Copy link
Contributor Author

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.

@mercuryyy
Copy link
Contributor

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.

@ckbo3hrk
Copy link
Contributor Author

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.

@mercuryyy
Copy link
Contributor

@ckbo3hrk Do you have an updated snippet to use srcdoc only for supported browsers ?

ckbo3hrk added a commit to ckbo3hrk/Prebid.js that referenced this issue Feb 17, 2017
@mkendall07
Copy link
Member

@mercuryyy
I think the snippet above does that.

@ckbo3hrk ckbo3hrk mentioned this issue Feb 17, 2017
3 tasks
mkendall07 pushed a commit that referenced this issue Mar 7, 2017
* fixed leading / omission on ie11

* srcdoc rendering approach to avoid http-referrer omission #977

* missing unit test for url.parse (leading slash in pathname)

* move isSrcdocSupported to utils
outoftime pushed a commit to Genius/Prebid.js that referenced this issue Mar 20, 2017
* fixed leading / omission on ie11

* srcdoc rendering approach to avoid http-referrer omission prebid#977

* missing unit test for url.parse (leading slash in pathname)

* move isSrcdocSupported to utils
@mkendall07
Copy link
Member

This is in master.

dluxemburg pushed a commit to Genius/Prebid.js that referenced this issue Jul 17, 2018
* fixed leading / omission on ie11

* srcdoc rendering approach to avoid http-referrer omission prebid#977

* missing unit test for url.parse (leading slash in pathname)

* move isSrcdocSupported to utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants