Configuring CMP for Prebid.js

When integrated with a CMP the header bidding scripts for Prebid may need the presence of a "shim" file to ensure that all the CMP objects that the script leverages are instantiated prior to the CMP code being fully loaded.

Sourcepoint provides a shim file that is inlined as a script tag prior to the loading of the prebid.js file. The code snippet below shows the placement of the shim file on a fictional example site.

<script src='//d2zv5rkii46miq.cloudfront.net/0/latest/cmp_shim.js'></script>
<script src='//somesite.com/prebid/prebid20180829.js'></script>

Within prebid there is the option to have the prebid.js script wait until the user has provided consent. In these cases, publishers may need to wait for any callback functions passed using the __cmp(‘getConsentData’, null, callback); to wait until the user has consented until the callback is fired. When this is implemented, Sourcepoint also provides a flag that will ensure that this happens. The flag is

window._sp_.config.cmp.waitForConsentData = true;

Below is an example of the flag within the Sourcepoint configuration.

<script data-cfasync="false" type="text/javascript">
( function () {//Boostratp code omited for brevity// standard configuration parameters for sourcepoint
window._sp_.config = window ._sp_.config || {};
window._sp_.config.account_id = 22;
window._sp_.config.content_control_callback = function () { } ;
window._sp_.config.mms_domain = 'ENTER YOUR CNAME SUBDOMAIN HERE'; // replace with your messaging domain// messaging-specific configuration
window._sp_.mms = window._sp_.mms || {};
window._sp_.mms.cmd = window._sp_.mms.cmd || [];//flags for CMP objects and commands
window._sp_.config.cmp = _sp_.config.cmp || {};
window._sp_.config.cmp.enabled = true;/*PREBID FLAG TO WAIT FOR CONSENT*/
window._sp_.config.cmp.waitForConsentData = true;window._sp_.config.mms_client_data_callback = function (o) {
console.log(o);
};window._sp_.config.mms_choice_selected_callback = function (choiceID) {
console.log( "Choice : id=" + choiceID);
};// tell the messaging library that all params are set and it can proceed
window._sp_.mms.cmd.push( function () {
window ._sp_.mms.startMsg();
});
// use the sourcepoint bootstrap code (inlined above) to load
// the main messaging library
//replace with the location to your file.
window._sp_.bootstrap( '/js/messaging.js'); })();
</script>

Please contact your Sourcepoint account manager with any questions you may have.