API Reference

getUserPreferences

The getUser command enables your organization to retrieve a list of categories and their preference status on properties who are utilizing a Preferences configuration.

Command

window._sp_.preferences.getUserPreferences((preferences, success) => console.log(preferences));

Response

[
  {
    "categoryId": 1,
    "consented": true
  },
  {
    "categoryId": 2,
    "consented": true
  },
]
schema:
  description: getUserPreferences return
  type: array
  items:
    type: object
    description: Contains the ID for Legal Preferences category or Marketing Preferences category and end-user consent for that category.
    properties:
      categoryId:
        type: number
        description: ID for the Legal Preferences category or Marketing Preferences category
        example: 1
      consented:
        type: boolean
        description: Whether end-user has accepted the Legal Preferences or Marketing Preferences category
        example: true