Track Unsubscribes

When users unsubscribe from Mixpanel emails, it gets tracked as a people property ($unsubscribed) with the value set to the timestamp the user unsubscribed. Additionally, an event called Notifications Unsubscribed will be sent to your project. This event will be sent with a Campaign property, set to the Message from which the user clicked to unsubscribe.

  Note

While the Campaign property will display the message from which the user unsubscribed, they will still be unsubscribed from all messages going forward.

Since people properties show the state of a user in the present point in time and not a historical view of the user over time, it’s not possible to view unsubscribe data for messages over time using the $unsubscribed property using one of Mixpanel’s out-of-the-box reports.

That said, you do have a few options for tracking unsubscribe data over time:

Use the Segmentation report to see unsubscribe data over time

  1. Select "Notification Unsubscribed" from the event dropdown in the Segmentation report.
  2. Adjust the date range to view unsubscribes for a particular period of time.
  3. To view unsubscribe data segmented by message select Campaign in the property drown. (Note that this is only the campaign from which the user unsubscribed).

Custom Unsubscribe Link

It is possible to look at email message unsubscribe data over time if you set up a custom unsubscribe page (i.e., you create your own unsubscribe link instead checking the default Mixpanel unsubscribe box).

2016-05-24_23_44_25.047321-include_unsubscribe_link.png

Modify the Unsubscribe Link in an Email

Custom HTML must be added in order to customize the unsubscribe link found in an email. The HTML should follow this format:

<a href="<< unsub >>">My custom unsubscribe link text</a>

Custom Unsubscribe Landing Page

By default, Mixpanel directs users who click on the unsubscribe link from emails to a Mixpanel-hosted unsubscribe page. This page runs a script that sets a people property $unsubscribed, with the value set to the timestamp the user unsubscribed - to that user’s profile. This prevents the user from receiving any more messages from that project, but does not globally unsubscribe them from Mixpanel messages.

However, it is possible to redirect users who click on the unsubscribe link from a Mixpanel email message to your own domain. This gives you a chance to re-engage with those customers one last time or style the page to match your site’s design.

Requirements

  • You must either be setting users’ distinct_ids as an additional property on their profiles; OR

  • You must be setting a different user ID, like email address or username, that is aliased to the Mixpanel distinct_id as a property on their profiles.

Setup

Your custom unsubscribe link will then look something like this - in this example, we’re using $email, which is set as a property on users’ people profiles and is aliased to the Mixpanel distinct_id:

<a href="www.example.com/unsubscribe.html?id={{$email}}">Unsubscribe</a>

Now on the unsubscribe page (www.example.com/unsubscribe.html), we will use our function to grab the value for “id.” However, instead of setting this value as a super property, we will use it as the distinct_id of a people set. This will allow us to set the “$unsubscribed=True” property to that specific user’s profile:

function getQueryParam(param) {
    param = param.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + param + "=([^&#]*)",
        regex = new RegExp( regexS ),
        results = regex.exec(document.URL);
    if (results === null || (results && typeof(results[1]) !== 'string' && results[1].length)) {
        return '';
    } else {
        return decodeURIComponent(results[1]).replace(/\+/g, ' ');
    }
};

var distinct_id = getQueryParam("id");
mixpanel.people.set({"$unsubscribed":"true"});
mixpanel.identify(distinct_id);
mixpanel.track("$unsubscribe",{
    "Campaign ID": campaign name,
});

Once your custom unsubscribe page is built, remember to uncheck the default unsubscribe option on your emails, and insert the link to your custom unsubscribe page at the end of your email instead:

2016-05-24_23_44_25.047321-include_unsubscribe_link.png

Find your answer?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.