Skip to content

Wrapper around Mixpanel PHP and JS libs for advanced events tracking

License

Notifications You must be signed in to change notification settings

tim-kozak/wordpress-mixpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MXTracker - Mixpanel tracker for wordpress and woocommerce analysis

Wrapper around Mixpanel PHP and JS libs for advanced events tracking

Main point is to have all events in one place will it be frontend events or backend or ajax triggered. You can get the thing when you look into MXTracker methods.

We inserting js library to each page automatically along with PHP library for each request. Doing identify automatically on frontend and backend. And you can chose place where you want to track particular event or property.

Here is the main methods:

  • api_track_event
  • js_track_event
  • api_set_super_properties
  • js_set_super_properties
  • etc.

Setup steps

  1. Clone this files to your theme folder
  2. Copy your Mixpanel token for next step
  3. Insert this code in your functions.php
 //helpers
 include_once 'mixpanel/tools.php';
 
 //check if mixpanel need to start (skip on cron or 404 etc.)
 if (mx_is_ok()) {
     //Tracker class
     include_once 'mixpanel/MXTracker.php';
     //Starting up
     MXTracker::instance('{-----your token here-----}');
     //Tracking file with all events
     include_once 'mixpanel/tracking_file.php';
 }
 
  1. Update tools.php - change HEAD_SCRIPT_HANDLER to any script you equeued with wp_enqueue_script()
  2. Put all your tracking code into mixpanel/tracking_file.php

Releases

No releases published

Packages

No packages published

Languages