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

Add native support for Criteo adapter #999

Merged
merged 1 commit into from
Jul 26, 2017

Conversation

Swiiip
Copy link
Contributor

@Swiiip Swiiip commented Feb 21, 2017

Type of change

  • [ x] Feature

Description of change

This feature provides a new parameter for the Criteo adapter:
New parameter: nativeCallback
Type: javascript function
Parameter: criteo native json response

This callback is called on the returned json for native zones.

@Swiiip
Copy link
Contributor Author

Swiiip commented Mar 10, 2017

Hello guys, could we have an update on this PR please ?
Thanks

@mkendall07
Copy link
Member

@Swiiip
Do you work for Criteo?
@icaroulle any thoughts on this?

@Swiiip
Copy link
Contributor Author

Swiiip commented Mar 10, 2017

@mkendall07 Yes I do work for Criteo

@ghost
Copy link

ghost commented Mar 10, 2017

@Swiiip aka Hugo h.duthil@criteo.com is indeed working for Criteo. 😄
@mkendall07 Can you please review this change?

@mkendall07
Copy link
Member

Ok thanks for the info guys. @matthewlane can you review?

@mkendall07
Copy link
Member

@Swiiip
@icaroulle
Apologies on the delay for reviewing this. We are currently working on a pattern to support Native ad format in Prebid.js. We'd like to hold off on merging this until that is finalized and we can offer better universal support. I'll let you additional details soon. Thanks!

@mkendall07
Copy link
Member

@Swiiip
Can you post an example function that would be passed to nativeCallback ?

@Swiiip
Copy link
Contributor Author

Swiiip commented Mar 22, 2017

@mkendall07

An example of native callback:

function(json) { 
    var li = $(".ccr-latest-post li")[0];
    var htmlcode = '';
    htmlcode += '<div class="ccr-thumbnail">';
    htmlcode += '<img src="'+ json.privacy.optout_image_url + '" style="width:19px;height:15px;position:absolute;right: 0px">';
    htmlcode += '<img src="'+ json.advertiser.logo.url + '" style="position: absolute; top: 0; left: 7px; padding: 3px 2px; line-height: 1; margin-left: -15px; font-size: 7px; letter-spacing: 1px; display: inline-block; text-transform: uppercase; -webkit-transform: rotate(-15deg); -moz-transform: rotate(-15deg); -ms-transform: rotate(-15deg); -o-transform: rotate(-15deg); transform: rotate(-15deg); width: 50% ">';
    htmlcode += '<img src="' + json.products[0].image.url + '" alt="Thumbnail 1" width="239px" height="191px" >';
    htmlcode += '<p><a href="' +  json.products[0].click_url + '">'+ "Go to: " + json.advertiser.domain +'</a></p>';
    htmlcode += '</div>';
    htmlcode += '<h4><a href="' + json.products[0].click_url + '">' + json.products[0].description.substring(0,40) + '</a></h4>';
    htmlcode += '<img src="' +json.products[0].viewurl + '" width="0px" height="0px" style="display:none" >';
    for (i in json.impression_pixels) {
        htmlcode += '<img src="' + json.impression_pixels[i].url + '" width="0px" height="0px" style="display:none" >';
    }							
    li.innerHTML = htmlcode;
    console.log(json);
}

@allanjun
Copy link
Collaborator

hi @mkendall07 any updates on this ?

// this code is executed in an iframe, we need to get a reference to the
// publishertag in the main window to retrieve native responses and callbacks.
// it doesn't work with safeframes
bidObject.ad = "<script type=\"text/javascript\">";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use string literals for constructing the templates. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@mkendall07
Copy link
Member

@allanjun @Swiiip please rebase to resolve conflicts and update to use string templates then we can merge. Also would be great to get the API documented. Thanks

@Swiiip Swiiip force-pushed the criteo-add-native branch from 0413360 to 27538d7 Compare July 21, 2017 15:45
@Swiiip
Copy link
Contributor Author

Swiiip commented Jul 21, 2017

I updated the PR, we will provide updated documentation for the adapter once validated internally.

@muuki88
Copy link
Collaborator

muuki88 commented Jul 25, 2017

we will provide updated documentation for the adapter once validated internally.

That's great news @Swiiip 😍 We currently read the code to figure out how to configure prebid, which is kinda awkward ;)

bidManager, 'addBidResponse',
function (adUnitCode, bid) {
let expectedAdProperty = `<script type=\"text/javascript\">
let win = window;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might consider indenting these lines.

mkendall07
mkendall07 previously approved these changes Jul 25, 2017
@mkendall07
Copy link
Member

@Swiiip it looks like the build is failing due to linting errors. Can you rebase 1 more time please and run eslint --fix on your file (or use your favorite editor to lint fix).

@Swiiip
Copy link
Contributor Author

Swiiip commented Jul 26, 2017

All set :)

@dbemiller dbemiller merged commit fc3c08c into prebid:master Jul 26, 2017
outoftime pushed a commit to Genius/Prebid.js that referenced this pull request Jul 28, 2017
…built

* 'master' of https://github.com/prebid/Prebid.js: (95 commits)
  Specify --browsers when using gulp test --watch (prebid#1420)
  Added aliases for aol adapter. (prebid#1371)
  Added MobFox Adapter (prebid#1312)
  Fixed style error. (prebid#1419)
  Add native support for Criteo adapter (prebid#999)
  Update admediaBidAdapter.js (prebid#1395)
  Increment pre version (prebid#1413)
  Prebid 0.26.1 Release (prebid#1412)
  fix prebid#1410 - issue with ie and xhr.timeout (prebid#1411)
  Lint modules directory (prebid#1404)
  Set outstream mediaType based on renderer in response (prebid#1391)
  Fixing the BidAdjustmentEvent fire time (prebid#1399)
  Fix banner showing up in prebid-core.js (prebid#1388)
  Mention NodeJS 4.0 dependency in the README (prebid#1386)
  Increment pre version (prebid#1385)
  Prebid 0.26.0 Release (prebid#1384)
  PulsePoint Lite adapter - adding createNew method for aliasing. (prebid#1383)
  Modernizing build dependencies (prebid#1355)
  StickyAdsTV bidder adapter update (prebid#1311)
  Added CPM value as parameter for Vertoz Adapter (prebid#1306)
  ...
jbAdyoulike pushed a commit to jbAdyoulike/Prebid.js that referenced this pull request Sep 21, 2017
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
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.

6 participants