Resurface Preferences message

   Permission: Campaign entities

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


Configure resurface Preferences message Javascript code

The code snippet to resurface your 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 Preferences message ID to the loadPreferenceCenter function. 

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

Screenshot 2025-03-03 at 4.30.37 PM.png

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

Screenshot 2025-01-15 at 11.25.00 AM.png

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

Screenshot 2025-03-04 at 6.28.48 AM.png

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

window._sp_.preferences.loadPreferenceCenter(PREF_MSG_ID)

Implement resurface Preferences message Javascript code

Attach the 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.