Optional Callbacks

Overview

Sourcepoint provides callbacks that you can define as part of its latest version of the messaging code. The callbacks available are:

<script type="text/javascript">
(function () { var e = false; var c = window; var t = document; function r() { if (!c.frames["__cmpLocator"]) { if (t.body) { var a = t.body; var e = t.createElement("iframe"); e.style.cssText = "display:none"; e.name = "__cmpLocator"; a.appendChild(e) } else { setTimeout(r, 5) } } } r(); function p() { var a = arguments; __cmp.a = __cmp.a || []; if (!a.length) { return __cmp.a } else if (a[0] === "ping") { a[2]({ gdprAppliesGlobally: e, cmpLoaded: false }, true) } else { __cmp.a.push([].slice.apply(a)) } } function l(t) { var r = typeof t.data === "string"; try { var a = r ? JSON.parse(t.data) : t.data; if (a.__cmpCall) { var n = a.__cmpCall; c.__cmp(n.command, n.parameter, function (a, e) { var c = { __cmpReturn: { returnValue: a, success: e, callId: n.callId } }; t.source.postMessage(r ? JSON.stringify(c) : c, "*") }) } } catch (a) { } } if (typeof __cmp !== "function") { c.__cmp = p; __cmp.msgHandler = l; c.addEventListener("message", l, false) } })();
</script>
<script>
window._sp_ = {
config: {
mmsDomain: "https://message{accountID}.sp-prod.net",
accountId: "{accountID}",
cmpOrigin: "https://sourcepoint.mgr.consensu.org",
events: {
onMessageReady: function () {
console.log('onMessageReady')
},
onMessageChoiceSelect: function (choice_id, choice_type_id) {
console.log('onMessageChoiceSelect choice_id: ', choice_id);
console.log('onMessageChoiceSelect choice_id: ', choice_type_id);
},
onPrivacyManagerAction: function (pmData) {
console.log('onPrivacyManagerAction', pmData)
},
onMessageChoiceError: function (err) {
console.log('onMessageChoiceError', err)
},
onConsentReady: function (consentUUID, euconsent) {
console.log('onConsentReady')
console.log('consentUUID', consentUUID)
console.log('euconsent', euconsent)
},
onPMCancel: function () {
console.log('onPMCancel')
},
onMessageReceiveData: function (data) {
console.log('onMessageReceiveData', data)
console.log(JSON.stringify(data));
},
onSPPMObjectReady: function () {
console.log('onSPPMObjectReady', window._sp_.loadPrivacyManagerModal)
// window._sp_.loadPrivacyManager(4400, '5d566301ab45d123ed973688')
}
},
targetingParams: {
test: 1
}
}
}
</script>
<script src="https://dialogue.sp-prod.net/messagingWithoutDetection.js"></script>
  • onMessageReady - this event fires when a message is about to display.

  • onMessageChoiceSelect - this event fires when a call-to-action button in a message has been clicked. The receives two integers. The first is the choice_id and it represents the id value of the choice selected that is specific to that choice. The second is the choice_type_id which is the ID of the type of choice clicked. A table of the choice type IDs is below.

  • onPrivacyManagerAction - this event fires when a button in a privacy manager has been clicked on. The data sent to the callback has the structure below with possible values for purposeConsent and vendorConsent being some, none or all. The value for the vendorList is returned undefined at this point in time. { purposeConsent: "all", vendorConsent: "all", vendorList: undefined }

  • onMessageChoiceError - this event fires when there was an error in the message delivery process. A brief description of the error is returned.

  • onConsentReady - this event fires when the consent object is ready. The consentUUID and euconsent values are sent to the callback.

  • onPMCancel - this event fires when a user hits the cancel button of the privacy manager.

  • onMessageReceiveData - this event fires when a message is displayed to the user and sends data about the message and campaign to the callback. The data sent to the callback in in the following structure: { "message_url":"https://notice.sp-prod.net?message_id=12345", "msg_id":"12345", "prtn_uuid":"6e769cbb-0adc-4ac2-b91c-743075736169", "msg_desc":"Consent Message 9.20.2019", "cmpgn_id":"39599", "bucket":"49", "uuid":"fa3db7d9-3258-46f1-8386-97ce2b4a5249" }

  • onSPPMObjectReady - this event fires when the privacy manager is ready to be displayed on the page. It can be used to notify on-page functions that the privacy manager is now available to be displayed using the Sourcepoint plug and play javascript code.

Choice Type ID Descriptions

Choice Type ID

Description

1

The user has chosen to view instructions on how to whitelist a site

2

The user has chosen to opt into ad recovery (no longer used)

3

The user has chosen to view a directly sold video instead of disabling adblockers (requires a separate agreement)

4

The user has chosen to view custom content in an iframe

5

The user has chosen a option to redirect to another page

6

The user has chosen to continue with adblockers enabled

7

The user has chosen a micropayment option (requires a separate agreement)

9

The user has selected an option tied to custom javascript on the site page

10

The user has chosen to view a video provided by Welect (requires a separate agreement)

11

The user has chosen the "Accept All" option in a consent message

12

The user has chosen to view a privacy manager (consent preferences) UI.

13

The user has chosen the "Reject All" message from a consent message

14

Samba Video (requires separate agreement with Samba and Sourcepoint)

15

Dismiss button