Resurface Universal Consent and Preferences message

   Permission: Campaign entities

The Universal Consent and Preferences message JavaScript code is a snippet that is added to a web property and allows an end-user to resurface a Universal Consent and Preferences message. Using this link/button, end-users can directly manage their Marketing Preferences and Legal Transaction selections on an ongoing basis. 


Configure resurface Universal Consent and Preferences message Javascript code

The code snippet to resurface your Universal Consent and Preferences message uses a loadPreferenceCenter function to pass the required arguments. The arguments required depends on whether your organization's use case supports anonymous end-users or requires an email address for marketing purposes. Please see the tabs below for more information:

Anonymous Email required

For user-cases that support anonymous end-users, your organization will need to pass the Universal Consent and Preferences message ID to the loadPreferenceCenter function. 

Retrieve the Universal Consent and Preferences message ID by clicking Messages on the left-hand panel and selecting Universal Consent and Preferences

Screenshot 2025-01-09 at 1.06.39 PM.png

Use the property field in the upper right-hand corner to select a property for which you will resurface a Universal Consent and Preferences message.

Screenshot 2025-01-15 at 11.25.00 AM.png

Navigate to your Preference Center message in the list and copy the ID inline with the Universal Consent and Preferences message name.

Screenshot 2025-01-15 at 11.30.56 AM.png

Format the resurface Universal Consent and Preferences message Javascript code so it adheres to the following:

window._sp_.preferences.loadPreferenceCenter(PREF_MSG_ID)

Implement resurface Universal Consent and Preferences message Javascript code

Attach the Universal Consent and Preferences message JavaScript code to an event handler on your property. Most organizations who implement the JavaScript code on their page will attach the function to the onclick event of a page element.

//anonymous
<button onclick="window._sp_.preferences.loadPreferenceCenter(28458)">Anonymous User</button>

//email required
<button onclick="window._sp_.preferences.loadPreferenceCenter(28458, 'test@email.com')">UCP</button>
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.