-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating the akamaiDAPIdSystem submodule with x1 APIs (#7137)
- Loading branch information
1 parent
ebaa5e5
commit a2c68d3
Showing
7 changed files
with
182 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,9 @@ | |
apiHostname: 'prebid.dap.akadns.net', | ||
domain: 'prebid.org', | ||
type: 'email', | ||
identity: '[email protected]' | ||
} | ||
identity: '[email protected]', | ||
apiVersion: 'v1' | ||
}, | ||
}, | ||
], | ||
syncDelay: 5000, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
|
||
<!-- | ||
This page calls a single bidder for a single ad slot. It can be considered a "hello world" example for using | ||
Prebid with the Google Publisher Tag. | ||
It also makes a good test page for new adapter PR submissions. Simply set your server's Bid Params object in the | ||
bids array inside the adUnits, and it will use your adapter to load an ad. | ||
NOTE that many ad servers won't send back an ad if the URL is localhost... so you might need to | ||
set an alias in your /etc/hosts file so that you can load this page from a different domain. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<script async src="../../build/dev/prebid.js"></script> | ||
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script> | ||
<script> | ||
var FAILSAFE_TIMEOUT = 3300; | ||
var PREBID_TIMEOUT = 2000; | ||
|
||
var adUnits = [{ | ||
code: 'div-gpt-ad-1460505748561-0', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250], [300,600]], | ||
} | ||
}, | ||
// Replace this object to test a new Adapter! | ||
bids: [{ | ||
bidder: 'grid', | ||
params: { | ||
uid: 1 | ||
} | ||
}] | ||
|
||
}]; | ||
|
||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
|
||
</script> | ||
|
||
<script> | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function() { | ||
googletag.pubads().disableInitialLoad(); | ||
}); | ||
|
||
pbjs.que.push(function() { | ||
pbjs.setConfig({ | ||
|
||
debugging: { | ||
enabled: true | ||
}, | ||
|
||
userSync: { | ||
userIds: [ | ||
{ | ||
name: 'akamaiDAPId', | ||
params: { | ||
apiHostname: 'prebid.dap.akadns.net', | ||
domain: 'prebid.org', | ||
type: 'email', | ||
identity: '[email protected]', | ||
apiVersion: 'x1', | ||
attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "Ace","last_name": "McCool" }' | ||
}, | ||
}, | ||
], | ||
syncDelay: 5000, | ||
auctionDelay: 2000, | ||
segments: [ 1, 2, 3 ], | ||
} | ||
}); | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.requestBids({ | ||
bidsBackHandler: sendAdserverRequest, | ||
timeout: PREBID_TIMEOUT | ||
}); | ||
document.getElementById( "user-ids" ).innerHTML = JSON.stringify( pbjs.getUserIds() ); | ||
}); | ||
|
||
function sendAdserverRequest() { | ||
if (pbjs.adserverRequestSent) return; | ||
pbjs.adserverRequestSent = true; | ||
googletag.cmd.push(function() { | ||
pbjs.que.push(function() { | ||
pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
|
||
setTimeout(function() { | ||
sendAdserverRequest(); | ||
}, FAILSAFE_TIMEOUT); | ||
|
||
</script> | ||
|
||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads()); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h2>Prebid.js Test</h2> | ||
<h5>Div-1</h5> | ||
<div id='div-gpt-ad-1460505748561-0'> | ||
<script type='text/javascript'> | ||
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); }); | ||
</script> | ||
</div> | ||
<h5>User IDs Sent to Bidding Adapter</h5> | ||
<div id="user-ids"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ Please reach out to your Akamai account representative([email protected]) to get | |
First, make sure to add the DAP submodule to your Prebid.js package with: | ||
|
||
``` | ||
gulp build --modules=akamaiDAPId,userId | ||
gulp build --modules=akamaiDAPIdSystem,userId | ||
``` | ||
|
||
The following configuration parameters are available: | ||
|
@@ -29,13 +29,20 @@ pbjs.setConfig({ | |
apiHostname: '<see your Akamai account rep>', | ||
domain: 'your-domain.com', | ||
type: 'email' | 'mobile' | ... | 'dap-signature:1.0.0', | ||
identity: ‘your@email.com’ | ‘6175551234' | ... | ||
identity: ‘your@email.com’ | ‘6175551234' | ...', | ||
apiVersion: 'v1' | 'x1', | ||
attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "...","last_name": "..." }' | ||
}, | ||
}], | ||
auctionDelay: 50 // 50ms maximum auction delay, applies to all userId modules | ||
} | ||
}); | ||
``` | ||
|
||
In order to make use of v1 APIs, "apiVersion" needs to explicitly mentioned as 'v1'. The "apiVersion" defaults to x1 if not specified. | ||
"attributes" can be configured in x1 API only and not v1 APIs. Please ensure that the "attributes" value is in same format as shown above. | ||
|
||
Refer to the sample integration example present at below location | ||
Prebid.js/integrationExamples/gpt/akamaidap_email_example.html | ||
Prebid.js/integrationExamples/gpt/akamaidap_signature_example.html | ||
Prebid.js/integrationExamples/gpt/akamaidap_x1_example.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,9 @@ pbjs.setConfig({ | |
apiHostname: '<see your Akamai account rep>', | ||
domain: 'your-domain.com', | ||
type: 'email' | 'mobile' | ... | 'dap-signature:1.0.0', | ||
identity: ‘[email protected]’ | ‘6175551234' | ... | ||
identity: ‘[email protected]’ | ‘6175551234' | ..., | ||
apiVersion: 'v1' | 'x1', | ||
attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "...","last_name": "..." }' | ||
} | ||
},{ | ||
name: 'identityLink', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,25 @@ export const storage = getStorageManager(); | |
const signatureConfigParams = {params: { | ||
apiHostname: 'prebid.dap.akadns.net', | ||
domain: 'prebid.org', | ||
type: 'dap-signature:1.0.0' | ||
type: 'dap-signature:1.0.0', | ||
apiVersion: 'v1' | ||
}}; | ||
|
||
const tokenizeConfigParams = {params: { | ||
apiHostname: 'prebid.dap.akadns.net', | ||
domain: 'prebid.org', | ||
type: 'email', | ||
identity: '[email protected]' | ||
identity: '[email protected]', | ||
apiVersion: 'v1' | ||
}}; | ||
|
||
const x1TokenizeConfigParams = {params: { | ||
apiHostname: 'prebid.dap.akadns.net', | ||
domain: 'prebid.org', | ||
type: 'email', | ||
identity: '[email protected]', | ||
apiVersion: 'x1', | ||
attributes: '{ "cohorts": [ "3:14400", "5:14400", "7:0" ],"first_name": "Ace","last_name": "McCool" }' | ||
}}; | ||
|
||
const consentData = { | ||
|
@@ -85,16 +96,22 @@ describe('akamaiDAPId getId', function () { | |
expect(submoduleCallback).to.be.undefined; | ||
}); | ||
|
||
it('should call the signature API and store token in Local storage', function () { | ||
it('should call the signature v1 API and store token in Local storage', function () { | ||
let submoduleCallback1 = akamaiDAPIdSubmodule.getId(signatureConfigParams, consentData).id; | ||
expect(submoduleCallback1).to.be.eq(storage.getDataFromLocalStorage('akamai_dap_token')) | ||
storage.removeDataFromLocalStorage('akamai_dap_token'); | ||
}); | ||
|
||
it('should call the tokenize API and store token in Local storage', function () { | ||
it('should call the tokenize v1 API and store token in Local storage', function () { | ||
let submoduleCallback = akamaiDAPIdSubmodule.getId(tokenizeConfigParams, consentData).id; | ||
expect(submoduleCallback).to.be.eq(storage.getDataFromLocalStorage('akamai_dap_token')) | ||
storage.removeDataFromLocalStorage('akamai_dap_token'); | ||
}); | ||
|
||
it('should call the tokenize x1 API and store token in Local storage', function () { | ||
let submoduleCallback = akamaiDAPIdSubmodule.getId(x1TokenizeConfigParams, consentData).id; | ||
expect(submoduleCallback).to.be.eq(storage.getDataFromLocalStorage('akamai_dap_token')) | ||
storage.removeDataFromLocalStorage('akamai_dap_token'); | ||
}); | ||
}); | ||
}); |