How to Track Events in Mixpanel

Events are the backbone of tracking in Mixpanel.  During your measurement plan, you will determine the key user actions and interactions that you want to track to help you answer your business questions. The user interaction and actions, will then need to be tracked as events in Mixpanel.

In this post, I will share two methods for you to track events in Mixpanel.

Tracking via JavaScript

If you are tracking by directly placing the code on the web pages then here are the steps:

  1. Finalize the name that you would like to use for the event. This is the name that will be shown in Mixpanel
  2. Add JavaScript code, mixpanel.track("event name goes here"); on the action/interaction that you want to track.
  3. If you do want to track parameters along with this event, determine the list of parameters and their values.
  4. Change the JavaScript code to,
    mixpanel.track("event name goes here",
    {'1st paramater name goes here': '1st paramater value goes here',
    '2nd paramater name goes here': '2nd paramater value goes here'});
    You will repeat the paramater name and values (key and value pair) for all the parameters that you want to send along with it.
  5. Save your code and publish it.

Tracking With Google Tag Manager

if you are using Google Tag Manager, then you can use a Mixpanel tag template for tracking events

  1. Click to add a new tag in Google Tag Manager
  2. Select the Mixpanel tag template (if it is not available, then find it in the community template gallery).
  3. In the tag template, fill in your Mixpannel project token. I usually store it in a variable and use the variable.
  4. Select tag type as "-Track"
  5. In track options, provide the name of the event
  6. Add Paramater to add paramater names and values
  7. Test and publish

 

Need Help with Mixpanel

Fill out the contact us form or email us at support@optizent.com

Leave a Reply

Your email address will not be published. Required fields are marked *