Send your first message

It should only take a couple of minutes to send your first message.

Install the Mixpanel JavaScript library

First, install a Mixpanel tracking library. In this example, we'll be using the JavaScript library, but there are many others (such as iOS and Android) for sending data from other platforms.

To install the library, just paste the following code into the <head> section of your HTML page. Make sure to change YOUR_TOKEN to your actual project token, which you can find by clicking your name in the upper righthand corner of your Mixpanel project and selecting Settings from the dropdown.

Create a profile

Mixpanel allows you to tie data to a specific user, creating a profile. This is where you store things like their email address, where they came from, or their age. When you include contact information, you can start sending targeted messages right from Mixpanel.

In this example, we're going to set up a new email message, so we need to create a profile with the "$email" property. Other types of messages (such as iOS and Android push notifications) require different properties.

    "User name": "JoeDoe1980",
    "$first_name": "Joe",
    "$last_name": "Doe",
    "$email": ""

Add your tracking code to the page and refresh to create the profile. 

Look at your report

At this point, there should be a new record in your Explore report:


Create a message

Move to the Messages report and select "Email Message" in the "Create new message" dropdown. You should see the following interface:


This interface should be largely self-explanatory, but it's important to note that you can use profile properties in all of the email fields.

Using profile properties in your email

Our templates will replace content that is wrapped in {{ }}. Here we're using the "User name" property we set before. In this case, we additionally wrap the property name in ${} to escape spaces.

Hey {{ ${User name} }},

Thanks for signing up. Need any help? 

Target users

When you submit the form, it will ask you to define the targeting criteria for your message. We're keeping it simple here and restricting the message to the user we just created. You can use many combinations of profile properties when you're creating a real message.


Schedule your email

Once you've targeted your users, you just have to schedule the email. There are two options for scheduling emails:

  • ASAP messages: These messages go out to individual users as soon as they match the targeting criteria for the first time. It's common for users to go from "not matching" to "matching" – many messages include a time-based requirement such as "last login was greater than two weeks ago", or one based off of other profile properties that may change (Mixpanel will only send the message to a user one time).
  • Scheduled messages: These messages can be set to go out at a specified time, day of week, or interval. For example, you could set your message to go out at 9am PST every Wednesday. When the message runs, it finds all the users who match the criteria you have defined (and who have never received this message) and sends it to them.
Find your answer?
0 out of 0 found this helpful



Article is closed for comments.