Manage Email subscriptions

You are responsible for complying with any applicable email marketing or spam laws for your region. In most cases, you need to provide users a way to unsubscribe from your marketing emails.

Unsubscribes

Leanplum provides an Unsubscribe Management feature. However, to use it, you need to include the Unsubscribe Link in your Leanplum emails.

  1. In the Email Composer, click Insert.
  2. Then click “Insert Unsubscribe Link”

Or, if you are working with your own HTML template, you can insert the following into your code:

<a href="{{ Unsubscribe URL }}">unsubscribe</a>

Leanplum will personalize this URL automatically, so when your users receive the email, it will be a personalized unsubscribe link just for them. Once unsubscribed, they will be excluded from all future marketing campaigns you send through Leanplum (see more about using categories below).

Alternatively, you can manage unsubscribes yourself. You can embed a link that goes to a webpage you control, then from there set the Leanplum unsubscribe status using our API. To manually unsubscribe a user:

https://www.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY&action=setUserAttributes&userId=USER_ID&unsubscribeChannelsToAdd=Email

You can find your APP_ID and CLIENT_KEY in “Keys & Settings” in the Leanplum dashboard.

Subscription Categories (BETA)

In your App Settings, you can create and customize email subscription categories. Doing so will allow you to limit any user unsubscribes to the specific category of that email, instead of all Leanplum emails.

Some examples of categories might be:

  • Newsletter
  • Product Announcement
  • Re-engagement

Note: Subscription categories in Leanplum are Id-based and app-specific. In other words, if you have multiple Leanplum apps (one for Android, one for iOS), your email subscriptions are split into two separate subscription lists. If a user unsubscribes from one Leanplum app's list, it does not unsubscribe them from your other app's subscription list (even if the subscription categories share the same name). Given this, we highly recommend using a single Leanplum app for all your email needs. 

 

Once these categories are defined in your App Settings, you can select a category for each email message you create, right in the Message Composer.

For emails you've sent with a category, the Unsubscribe Link will take users to a webpage that includes an option to unsubscribe from, or opt out of, that category. See more below.

How unsubscribing works with subscription categories

When a user clicks the Unsubscribe Link in your email, they will be taken to a webpage with two options:

  1. Unsubscribe from [this email's category] (only if you set a category)
  2. Unsubscribe from all marketing emails

If a user unsubscribes from a category, any future emails for that category will not be sent to them, even if they are in the target group. They will still receive marketing emails for other categories.

On the other hand, if a user unsubscribes from all marketing emails, then they will no longer receive any uncategorized or categorized marketing emails. They will, however, still receive transactional emails.

Transactional emails will always be delivered to all users in the target group, regardless of their subscription status for marketing emails. Users cannot unsubscribe from transactional emails.

Manage category subscriptions

You can manage category subscriptions with our API using the category ID. Using the API is essential for handling resubscribes (since we currently only support re-subscriptions via our API -- see more below).

To unsubscribe a user from category id 1:

https://www.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY&action=setUserAttributes&userId=USER_ID&unsubscribeCategoriesToAdd=1

To re-subscribe a user to category id 1:

https://www.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY&action=setUserAttributes&userId=USER_ID&unsubscribeCategoriesToRemove=1

To re-subscribe a user to category id 1 and id 3 at the same time:

POST https://www.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY
{
"action":"setUserAttributes",
"userId":"USER_ID",
"unsubscribeCategoriesToRemove": ["1","3"]
}

**This feature is currently in Beta. Please contact your Customer Success Manager to get started.  

Re-subscriptions

Leanplum does not currently give users a direct interface to resubscribe, but you can use our API to resubscribe a user.

https://www.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY&action=setUserAttributes&userId=USER_ID&unsubscribeChannelsToRemove=Email

The APP_ID and CLIENT_KEY can be found in the "Keys & Settings" of your Leanplum app. You should use your "Production" key.

 


Was this article helpful?
Have more questions? Submit a request