HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Subscription lists

How to subscribe and unsubscribe identifiers from subscription Lists in Optimizely Data Platform (ODP) using the Web SDK.

Lists let you group customers for the purposes of tracking their communication preferences, such as letting customers subscribe to your company newsletter or for holiday news. Use lists to organize your customers and make targeted communication easier.

📘

Note

ODP does not require customers to be subscribed to a List to receive emails.

Subscribe or subscribe example

Call the subscribe() or unsubscribe() method to add or remove a customer from a list.

// subscribe [email protected] to newsletter list
zaius.subscribe({list_id: 'newsletter', email: '[email protected]'});

// unsubscribe [email protected] from newsletter list
zaius.unsubscribe({list_id: 'newsletter', email: '[email protected]'});
// subscribe [email protected] to three lists at once
zaius.subscribe({
  list_id: ["newsletter", "promotion", "product_update"], 
  email: "[email protected]"
});

// unsubscribe [email protected] from multiple lists at once
zaius.unsubscribe({
  list_id: ["newsletter", "product_update"], 
  email: "[email protected]"
});
zaius.subscribe({
  // subscribe Johnny to all lists
  
  list_id: ["newsletter", "promotion", "product_update"],
  email: "[email protected]",
  
  // update Johnny's record to include his full name
  first_name: "Johnny",
  last_name: "Zaius",
  
  // store information on the subscribe events
  event_custom_field: "my custom value",
  custom_number_field: 123
  
});

// zaius.unsubscribe also fully supports this syntax.

Events

ODP generates events automatically for the purposes of analytics and auditing. The events are structured as follows:

Event TypeEvent ActionList IDData/Time
listsubscribenewsletter123456
listunsubscribenewsletter123456

Next