Skip to content

Commit

Permalink
Update ref param sonobi (prebid#2891)
Browse files Browse the repository at this point in the history
* added vp param to trinity request

* added lib_name and lib_v to trinity

* return null from buildRequests if there is no keymakers

* added test case for empty keymaker

* only importing functions we need from utils

* changed window.pbjs.version to use the gulp repalced macro .version$

* fixed issue where isEmpty was being called from old utils var. Changed test port expectations to the original 9876 port

* fixed lint issue

* fixed issue where sonobi getUserSync was throwing an error on timeout

* sonobi support referrer param

* fixed unit test for testing the ref param on bid request

* return null from buildRequests if there is no keymakers

* fixed issue where isEmpty was being called from old utils var. Changed test port expectations to the original 9876 port

* Add gdpr support

* update ref param to use href instead of host
  • Loading branch information
bansawbanchee authored and AdSpacesDevelopers committed Jan 30, 2019
1 parent 3df35d1 commit fdfcd9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const spec = {

const payload = {
'key_maker': JSON.stringify(data),
'ref': getTopWindowLocation().host,
'ref': getTopWindowLocation().href,
's': generateUUID(),
'pv': PAGEVIEW_ID,
'vp': _getPlatform(),
Expand Down Expand Up @@ -183,12 +183,12 @@ const _creative = (mediaType) => (sbi_dc, sbi_aid) => {
if (mediaType === 'video') {
return _videoCreative(sbi_dc, sbi_aid)
}
const src = 'https://' + sbi_dc + 'apex.go.sonobi.com/sbi.js?aid=' + sbi_aid + '&as=null' + '&ref=' + getTopWindowLocation().host;
const src = 'https://' + sbi_dc + 'apex.go.sonobi.com/sbi.js?aid=' + sbi_aid + '&as=null' + '&ref=' + getTopWindowLocation().href;
return '<script type="text/javascript" src="' + src + '"></script>';
};

function _videoCreative(sbi_dc, sbi_aid) {
return `https://${sbi_dc}apex.go.sonobi.com/vast.xml?vid=${sbi_aid}&ref=${getTopWindowLocation().host}`
return `https://${sbi_dc}apex.go.sonobi.com/vast.xml?vid=${sbi_aid}&ref=${getTopWindowLocation().href}`
}

function _getBidIdFromTrinityKey (key) {
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe('SonobiBidAdapter', () => {
'url': 'https://apex.go.sonobi.com/trinity.json',
'withCredentials': true,
'data': {
'key_maker': '{"30b31c1838de1f":"1a2b3c4d5e6f1a2b3c4d|300x250,300x600|f=1.25","/7780971/sparks_prebid_LB|30b31c1838de1e":"300x250,300x600"}', 'ref': 'localhost:9876', 's': '2474372d-c0ff-4f46-aef4-a173058403d9', 'pv': 'c9cfc207-cd83-4a01-b591-8bb29389d4b0'
'key_maker': '{"30b31c1838de1f":"1a2b3c4d5e6f1a2b3c4d|300x250,300x600|f=1.25","/7780971/sparks_prebid_LB|30b31c1838de1e":"300x250,300x600"}', 'ref': 'http://localhost:9876/', 's': '2474372d-c0ff-4f46-aef4-a173058403d9', 'pv': 'c9cfc207-cd83-4a01-b591-8bb29389d4b0'
},
'bidderRequests': [
{
Expand Down Expand Up @@ -294,7 +294,7 @@ describe('SonobiBidAdapter', () => {
'cpm': 1.07,
'width': 300,
'height': 600,
'ad': '<script type="text/javascript" src="https://mco-1-apex.go.sonobi.com/sbi.js?aid=30292e432662bd5f86d90774b944b039&as=null&ref=localhost:9876"></script>',
'ad': '<script type="text/javascript" src="https://mco-1-apex.go.sonobi.com/sbi.js?aid=30292e432662bd5f86d90774b944b039&as=null&ref=http://localhost:9876/"></script>',
'ttl': 500,
'creativeId': '1234abcd',
'netRevenue': true,
Expand All @@ -306,7 +306,7 @@ describe('SonobiBidAdapter', () => {
'cpm': 1.25,
'width': 300,
'height': 250,
'ad': 'https://mco-1-apex.go.sonobi.com/vast.xml?vid=30292e432662bd5f86d90774b944b038&ref=localhost:9876',
'ad': 'https://mco-1-apex.go.sonobi.com/vast.xml?vid=30292e432662bd5f86d90774b944b038&ref=http://localhost:9876/',
'ttl': 500,
'creativeId': '30292e432662bd5f86d90774b944b038',
'netRevenue': true,
Expand Down

0 comments on commit fdfcd9b

Please sign in to comment.