Track your first event

It should only take a few minutes to get started tracking events with these three steps:

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 other libraries (such as iOS and Android) for sending data from other platforms.

To install the library, paste the following code into the <head> section of your website's HTML page:

 
You must insert your unique project token into the code to successfully send data to your Mixpanel project. In the last line of the code, change YOUR_TOKEN to your unique project token. The project token can be found by clicking the settings gear in the upper right corner of your Mixpanel project, and then selecting "Project settings" from the dropdown.
V2_Project_Settings.png
 

Track an event

Events are captured programmatically using code. Here we'll track the "Video played" event; in practice, you should figure out an event that is relevant to your business. We're also including two properties, "length" and "id". Properties describe the event you are tracking or the user who triggered the event. You can include your own properties by passing them in an object as the second argument to mixpanel.track:

<script type="text/javascript">
    mixpanel.track("Video played", {
        "Video length": 213,
        "id": "hY7gQr0"
    });
</script>

Add your event tracking code to the page and refresh.

Look at your report

At this point, there should be data visible on your report. The report should look something like this:

Screenshot_2018-03-23_14.23.42.png
 
 
Find your answer?
16 out of 41 found this helpful

Comments

0 comments

Article is closed for comments.