Mixpanel
By Prashant Agarwal
Agenda

What is Mixpanel

Need for Mixpanel

Setup

Access Mixpanel Database

Real Time Example

Demo
What is Mixpanel
&Mixpanel is the most advanced analytics platform for mobile
. ,web Instead of measuring pageviews it helps you analyze the
.actions people take in your application An action can be
- , ,anything someone uploading a picture playing a video or
,sharing a post for example
There are three things you
need to know about Mixpanel

Event

Property

Profile
Event
An event is an action someone takes in your application or
on your website
Property
A property is a little bit of extra information that describes an
event
Profile
A profile is where you store properties about a specific user
- , ,things like an email address where they came from or
their age
/Need For Mixpanel Data
Analytics
Data analytics examines large amounts of data to
,uncover hidden patterns correlations and other
. ’ , ’insights With today s technology like Mixpanel it s
possible to analyze your data and get answers from it
almost immediately
Setup
Paste the following code into the <head> section of your HTML page
<!-- start Mixpanel --><script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var
c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?
l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setIt
em("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var
k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var
c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var
a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people
(stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify
name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge
people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!
0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?
MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-
latest.min.js".match(/^///)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-
latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init("YOUR TOKEN");</script><!-- end Mixpanel →
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
Tracking an Event
.Each event you want to track is just a single line of code Or
,alternatively if you want to track user actions on your website
by creating events in a visual Point
' " " ; ,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
Code is
< =" / ">script type text javascript
. (" ", {mixpanel track Video played
" ": 213,Video length
" ": " 7 0"id hY gQr
});
</ >script
Add your event tracking code to the page and refresh.
Creating 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.
Creating a profile
In this example, we're going to create a new profile with the
properties "$first_name", "$last_name", "$created" - special
properties have a leading "$". You shouldn't make up your own
property names beginning with "$"
It's important to note that you must call mixpanel.identify to
actually create a new profile. This flushes data from the client to
Mixpanel's servers
Creating a profile
mixpanel.identify("13487");
mixpanel.people.set({
"$first_name": "Joe",
"$last_name": "Doe",
"$created": "2013-04-01T09:02:00",
"$email": "joe.doe@example.com"
});
Add your tracking code to the page and refresh to
.create the profile
Accessing Mixpanel Database

" "Get a raw dump of tracked
events over a time period

Get People Data
" "Get a raw dump of tracked
events over a time period
: :// . . / /2.0/URI https data mixpanel com api export
_ - - -from date The date in yyyy mm dd format from which to begin
. .querying for the event from This date is inclusive
_ - - -to date The date in yyyy mm dd format from which to stop
. .querying for the event from This date is inclusive
- ,Event The event or events that you wish to get data for encoded as
. : '[" ", " ", "a JSON array Example format play song log in add
"]'playlist
- .Where An expression to filter events by See the expression section
.on the main data export API page
" "Get a raw dump of tracked
events over a time period
:Return format
{" ":" "," ":event Viewed report properties
{" _ ":" "," ":132926374distinct id foo time
8," ":" "," _ ":"origin invite origin referrer ht
:// . / /","$tp mixpanel com projects initial
_ _ ":" . ",referring domain mixpanel com
"$ ":" :// . /referrer https mixpanel com rep
/3/ /","$ _ ":"ort stream initial referrer htt
Get People Data
URI: https://mixpanel.com/api/2.0/engage/
Where - An expression to filter people by. See the expressions
section above.
session_id - A string id provided in the results of a previous query.
Using a session_id speeds up api response, and allows paging
through results.
Page - Which page of the results to retrieve. Pages start at zero. If
the "page" parameter is provided, the session_id parameter must
also be provided.
Real Time Example
Content Websites - Huffington Post
One area where we are seeing real-time analytics improve content
companies is in article headlines. For most of us, an article headline
is all we use to decide whether or not to read on, so having a good
one is definitely important. The Huffington Post is ahead of the
game here.
The Huffington Post initially shows 2 headlines for the same
story, after 5 minutes of testing they discard the less popular one.
For demo project please visit
https://github.com/NexThoughts/Mix-Panel
...Thanks for listening

Mixpanel

  • 1.
  • 2.
    Agenda  What is Mixpanel  Needfor Mixpanel  Setup  Access Mixpanel Database  Real Time Example  Demo
  • 3.
    What is Mixpanel &Mixpanelis the most advanced analytics platform for mobile . ,web Instead of measuring pageviews it helps you analyze the .actions people take in your application An action can be - , ,anything someone uploading a picture playing a video or ,sharing a post for example
  • 4.
    There are threethings you need to know about Mixpanel  Event  Property  Profile
  • 5.
    Event An event isan action someone takes in your application or on your website Property A property is a little bit of extra information that describes an event Profile A profile is where you store properties about a specific user - , ,things like an email address where they came from or their age
  • 6.
    /Need For MixpanelData Analytics Data analytics examines large amounts of data to ,uncover hidden patterns correlations and other . ’ , ’insights With today s technology like Mixpanel it s possible to analyze your data and get answers from it almost immediately
  • 7.
    Setup Paste the followingcode into the <head> section of your HTML page <!-- start Mixpanel --><script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))? l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setIt em("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" "); for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=! 0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL? MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2- latest.min.js".match(/^///)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2- latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]); mixpanel.init("YOUR TOKEN");</script><!-- end Mixpanel → 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
  • 8.
    Tracking an Event .Eachevent you want to track is just a single line of code Or ,alternatively if you want to track user actions on your website by creating events in a visual Point ' " " ; ,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
  • 9.
    Code is < ="/ ">script type text javascript . (" ", {mixpanel track Video played " ": 213,Video length " ": " 7 0"id hY gQr }); </ >script Add your event tracking code to the page and refresh.
  • 10.
    Creating a profile Mixpanelallows 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.
  • 11.
    Creating a profile Inthis example, we're going to create a new profile with the properties "$first_name", "$last_name", "$created" - special properties have a leading "$". You shouldn't make up your own property names beginning with "$" It's important to note that you must call mixpanel.identify to actually create a new profile. This flushes data from the client to Mixpanel's servers
  • 12.
    Creating a profile mixpanel.identify("13487"); mixpanel.people.set({ "$first_name":"Joe", "$last_name": "Doe", "$created": "2013-04-01T09:02:00", "$email": "joe.doe@example.com" }); Add your tracking code to the page and refresh to .create the profile
  • 13.
    Accessing Mixpanel Database  ""Get a raw dump of tracked events over a time period  Get People Data
  • 14.
    " "Get araw dump of tracked events over a time period : :// . . / /2.0/URI https data mixpanel com api export _ - - -from date The date in yyyy mm dd format from which to begin . .querying for the event from This date is inclusive _ - - -to date The date in yyyy mm dd format from which to stop . .querying for the event from This date is inclusive - ,Event The event or events that you wish to get data for encoded as . : '[" ", " ", "a JSON array Example format play song log in add "]'playlist - .Where An expression to filter events by See the expression section .on the main data export API page
  • 15.
    " "Get araw dump of tracked events over a time period :Return format {" ":" "," ":event Viewed report properties {" _ ":" "," ":132926374distinct id foo time 8," ":" "," _ ":"origin invite origin referrer ht :// . / /","$tp mixpanel com projects initial _ _ ":" . ",referring domain mixpanel com "$ ":" :// . /referrer https mixpanel com rep /3/ /","$ _ ":"ort stream initial referrer htt
  • 16.
    Get People Data URI:https://mixpanel.com/api/2.0/engage/ Where - An expression to filter people by. See the expressions section above. session_id - A string id provided in the results of a previous query. Using a session_id speeds up api response, and allows paging through results. Page - Which page of the results to retrieve. Pages start at zero. If the "page" parameter is provided, the session_id parameter must also be provided.
  • 17.
    Real Time Example ContentWebsites - Huffington Post One area where we are seeing real-time analytics improve content companies is in article headlines. For most of us, an article headline is all we use to decide whether or not to read on, so having a good one is definitely important. The Huffington Post is ahead of the game here. The Huffington Post initially shows 2 headlines for the same story, after 5 minutes of testing they discard the less popular one.
  • 18.
    For demo projectplease visit https://github.com/NexThoughts/Mix-Panel ...Thanks for listening