Blueshift automatically unsubscribes users when they click on the unsubscribe link in the footer or headers in the email. However, there may be scenarios where you may want to manually unsubscribe user(s). You can accomplish this few ways.

1. Single User Unsubscribe

To unsubscribe a single user, simply search for the user on the Customer Attribute page. Click on the Edit drop-down menu and check the Unsubscribed flag on the profile page.

Screen_Shot_2018-03-30_at_5.43.38_PM.png

2. User Attribute Upload

  • Prepare a csv with email/customer_id and unsubscribed (true)
  • Upload file via customer attribute process

b74e14b-Unsubscribed_Attribute_File.png

3. Unsubscribe via User API

  • cURL
curl  \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-X POST \
-d '{"email":"testuser@getblueshift.com", "unsubscribed": "true"}' \
-u <USER_API_KEY>: https://api.getblueshift.com/api/v1/customers

4. Identify

Refer to the Identify event to pass unsubscribed status of a user

5. Self-Hosted Unsubscribe Pages

In a self-hosted unsubscribe page setup, where users are directed to a custom URL instead of {{unsubscribe_link}}, a simple way to record the unsubscribe action in Blueshift and make sure that campaign attribution is preserved is to pass the unsubscribe_link as a URL parameter.

For example:

<a bsft-no-track href="https://www.example.com/imaginary_unsubscribe_page?customer_id={{user.customer_id}}&bsft_unsub={{unsubscribe_link | url_encode}}">Unsubscribe<a>

Note: "bsft-no-track" must be present on the link in order for this to work.

Example formatted URL:

https://www.example.com/imaginary_unsubscribe_page?bsft_unsub=https%3A%2F%2Funiversallinks.blueshiftreads.com%2Fcustomer%2Funsubscribe%3Fuid%3De6afc3fc-f3e9-4142-836b-50cbb05c5e55%26mid%3Dcdf1727f-bdec-462b-9969-23f18d859a18%26txnid%3D99af1bf5-969e-416f-b331-917eff4617b7%26eid%3D433b295e-cdfe-0f5a-5cca-cfa46f6809fc%26bsft_ek%3D2021-04-26T19%253A15%253A46Z%26bsft_aaid%3D48400530-21e4-4403-826c-d50cc97d18b7%26bsft_mime_type%3Dhtml%26bsft_link_id%3D4%26bsft_tv%3D5%26bsft_lx%3D4

The backend handling this request will need to decode the bsft_unsub parameter and make a request to that URL. This will simulate a user clicking the link directly in their email, and preserves the attribution of the unsubscribe action to the particular experiment, trigger, and campaign involved with the message.

Example client-side get call:

function getQueryVariable(variable) {
const query = window.location.search.substring(1);
const vars = query.split('&');
for (let i = 0; i < vars.length; i++) {
const pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
}
const unsubscribeLink = getQueryVariable('bsft_unsub')
fetch(unsubscribeLink, { mode: 'no-cors'})
.then((response) => console.log(response))

Unsubscribed attributes: 

Email: 

unsubscribed

unsubscribed_at (This is set automatically when we receive the unsubscribed event)

 

Push:

unsubscribed_push

unsubscribed_push_at

 

In-app:

unsubscribed_inapp

unsubscribed_inapp_at

 

SMS:

unsubscribed_sms

unsubscribed_sms_at

 

Standard Attributes

opted_in

opted_in_at

 

*You can add any custom attributes you want on the user to manage your subscriptions

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.