Skip to content

Commit

Permalink
update gdpr test page to use CMP stub setup code (prebid#2616)
Browse files Browse the repository at this point in the history
* upadte gdpr test page to use proper CMP setup code

* remove test comment
  • Loading branch information
jsnellbaker authored and dluxemburg committed Jul 17, 2018
1 parent ce7abf3 commit b97d2e8
Showing 1 changed file with 76 additions and 2 deletions.
78 changes: 76 additions & 2 deletions integrationExamples/gpt/gdpr_hello_world.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,81 @@
<html>
<head>
<script>window.__cmp = {config: {logging: 'debug'}}</script>
<script src="//acdn.adnxs.com/cmp/cmp.complete.bundle.js" async></script>
<script>
(function(window, document) {
if (!window.__cmp) {
window.__cmp = (function() {
var listen = window.attachEvent || window.addEventListener;
listen('message', function(event) {
window.__cmp.receiveMessage(event);
}, false);

function addLocatorFrame() {
if (!window.frames['__cmpLocator']) {
if (document.body) {
var frame = document.createElement('iframe');
frame.style.display = 'none';
frame.name = '__cmpLocator';
document.body.appendChild(frame);
} else {
setTimeout(addLocatorFrame, 5);
}
}
}
addLocatorFrame();

var commandQueue = [];
var cmp = function(command, parameter, callback) {
if (command === 'ping') {
if (callback) {
callback({
gdprAppliesGlobally: !!(window.__cmp && window.__cmp.config && window.__cmp.config.storeConsentGlobally),
cmpLoaded: false
});
}
} else {
commandQueue.push({
command: command,
parameter: parameter,
callback: callback
});
}
}
cmp.commandQueue = commandQueue;
cmp.receiveMessage = function(event) {
var data = event && event.data && event.data.__cmpCall;
if (data) {
commandQueue.push({
callId: data.callId,
command: data.command,
parameter: data.parameter,
event: event
});
}
};
cmp.config = {
//
// Modify config values here
//
// globalVendorListLocation: 'https://vendorlist.consensu.org/vendorlist.json',
// customPurposeListLocation: './purposes.json',
// globalConsentLocation: './portal.html',
// storeConsentGlobally: false,
// storePublisherData: false,
logging: 'debug',
// localization: {},
// forceLocale: 'en-us'
}
return cmp;
}());
var t = document.createElement('script');
t.async = false;
t.src = 'http://acdn.adnxs.com/cmp/cmp.bundle.js';
var tag = document.getElementsByTagName('head')[0];
tag.appendChild(t);
}
})(window, document);
window.__cmp('showConsentTool');
</script>

<script>
var PREBID_TIMEOUT = 700;
Expand Down

0 comments on commit b97d2e8

Please sign in to comment.