Skip to content

Commit

Permalink
YIELDONE adapter - added UserSync (#3045)
Browse files Browse the repository at this point in the history
* added UserSync

* added UserSync Unit Test
  • Loading branch information
kusapan authored and bretg committed Sep 6, 2018
1 parent bf4e2d6 commit 0f401ee
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/yieldoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {registerBidder} from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'yieldone';
const ENDPOINT_URL = '//y.one.impact-ad.jp/h_bid';
const USER_SYNC_URL = '//y.one.impact-ad.jp/push_sync';

export const spec = {
code: BIDDER_CODE,
Expand Down Expand Up @@ -66,6 +67,14 @@ export const spec = {
bidResponses.push(bidResponse);
}
return bidResponses;
},
getUserSyncs: function(syncOptions) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: USER_SYNC_URL
}];
}
}
}
registerBidder(spec);
12 changes: 12 additions & 0 deletions modules/yieldoneBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ THE YIELDONE adapter requires setup and approval from the YIELDONE team. Please
}]
}];
```

### Configuration

YIELDONE recommends the UserSync configuration below. Without it, the YIELDONE adapter will not able to perform user syncs, which lowers match rate and reduces monetization.

```javascript
pbjs.setConfig({
userSync: {
iframeEnabled: true,
enabledBidders: ['yieldone']
}});
```
16 changes: 16 additions & 0 deletions test/spec/modules/yieldoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,20 @@ describe('yieldoneBidAdapter', function() {
expect(result.length).to.equal(0);
});
});

describe('getUserSyncs', function () {
const userSyncUrl = '//y.one.impact-ad.jp/push_sync';

it('handles empty sync options', function () {
expect(spec.getUserSyncs({})).to.be.empty;
});

it('should return a sync url if iframe syncs are enabled', function () {
expect(spec.getUserSyncs({
'iframeEnabled': true
})).to.deep.equal([{
type: 'iframe', url: userSyncUrl
}]);
});
});
});

0 comments on commit 0f401ee

Please sign in to comment.