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

Expose native image-type asset dimensions on bid response object #1919

Merged
merged 2 commits into from
Dec 6, 2017

Conversation

matthewlane
Copy link
Collaborator

Type of change

  • Feature

Description of change

Currently if a native bidder returns an image-type asset (image or icon), the url for that asset is set to the image or icon property on the bid response native object:

// in a bidder adapter's interpretResponse function...
bid['native'] = {
  title: serverResponse['native'].title,
  image: serverResponse['native'].img.url,
  icon: serverResponse['native'].icon.url,
};
// ...

If a native bidder also provides a width and height associated with an image-type asset, the bidder can now set those dimensions on the native bid response object using an object instead of a string:

bid['native'] = {
  title: serverResponse['native'].title,
  image: {
    url: serverResponse['native'].img.url,
    height: serverResponse['native'].img.height,
    width: serverResponse['native'].img.width,
  },
  icon: serverResponse['native'].icon.url,
};

As the above example shows, setting native.image or native.icon to a url string will continue to work. The targeting key hb_native_image will be set with the value of image.url if image is an object, or the value of image if image is a string (and likewise for hb_native_icon / icon).

@harpere harpere added the LGTM label Dec 5, 2017
@jaiminpanchal27 jaiminpanchal27 merged commit 67879a9 into master Dec 6, 2017
@matthewlane matthewlane deleted the native-img-dimensions branch December 6, 2017 21:56
Millerrok pushed a commit to Vertamedia/Prebid.js that referenced this pull request Dec 8, 2017
* 'master' of https://github.com/prebid/Prebid.js: (43 commits)
  Merge Prebid 1.0 to Master (prebid#1936)
  Prebid.js 0.34.1 release
  Vertamedia adapter outstream support (prebid#1860)
  Expose native image-type asset dimensions on bid response object (prebid#1919)
  Remove for of (prebid#1932)
  Unit-test fix (prebid#1927)
  Remove description_url (prebid#1922)
  Trion Interactive Adapter Bugfix (prebid#1925)
  Remove config setting from Optimatic adapter (prebid#1909)
  IE bug fix (prebid#1930)
  Clarify ad unit media filtering warning (prebid#1903)
  Add ReadPeak Bid Adapter (prebid#1838)
  Change clone function to make deep copies (prebid#1910)
  Serverbid 1.0 (prebid#1802)
  sekindoUM for prebid1.0 (prebid#1777)
  update auctionId to be requestId (prebid#1896)
  bug fixed to populate userSync default values (prebid#1897)
  Increment pre version
  AdkernelAdn analytics adapter (prebid#1868)
  Justpremium Adapter: use `filter` instead of `...new Set` (prebid#1895)
  ...
vzhukovsky added a commit to aol/Prebid.js that referenced this pull request Dec 28, 2017
….34.0 to aolgithub-master

* commit 'f0ba90afa8b52de7a646d43928b2d51ee42e74a1': (53 commits)
  Added changelog entry.
  Added partners ids.
  Added dynamic ttl property for One Display and One Mobile.
  Prebid.js 0.34.1 release
  Vertamedia adapter outstream support (prebid#1860)
  Expose native image-type asset dimensions on bid response object (prebid#1919)
  Remove for of (prebid#1932)
  Unit-test fix (prebid#1927)
  Remove description_url (prebid#1922)
  Trion Interactive Adapter Bugfix (prebid#1925)
  Remove config setting from Optimatic adapter (prebid#1909)
  IE bug fix (prebid#1930)
  Clarify ad unit media filtering warning (prebid#1903)
  Add ReadPeak Bid Adapter (prebid#1838)
  Change clone function to make deep copies (prebid#1910)
  Serverbid 1.0 (prebid#1802)
  sekindoUM for prebid1.0 (prebid#1777)
  update auctionId to be requestId (prebid#1896)
  bug fixed to populate userSync default values (prebid#1897)
  Increment pre version
  ...
rmloveland pushed a commit to prebid/prebid.github.io that referenced this pull request Jan 9, 2018
rmloveland added a commit to prebid/prebid.github.io that referenced this pull request Jan 10, 2018
* Add docs for native image-type asset dimensions

Related to prebid/Prebid.js#1919

* Per feedback, this applies to `icon` assets, too
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
…bid#1919)

* Pass native image-type dimensions

* Expose native image-type asset dimensions on bid response object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants