Wrapper around Mixpanel PHP and JS libs for advanced events tracking
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:
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';
- }
tools.php
- change HEAD_SCRIPT_HANDLER to any script you equeued with wp_enqueue_script()
mixpanel/tracking_file.php