项目作者: tim-kozak

项目描述 :
Wrapper around Mixpanel PHP and JS libs for advanced events tracking
高级语言: PHP
项目地址: git://github.com/tim-kozak/wordpress-mixpanel.git
创建时间: 2017-08-17T13:45:34Z
项目社区:https://github.com/tim-kozak/wordpress-mixpanel

开源协议:MIT License

下载


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

    1. //helpers
    2. include_once 'mixpanel/tools.php';
    3.  
    4. //check if mixpanel need to start (skip on cron or 404 etc.)
    5. if (mx_is_ok()) {
    6. //Tracker class
    7. include_once 'mixpanel/MXTracker.php';
    8. //Starting up
    9. MXTracker::instance('{-----your token here-----}');
    10. //Tracking file with all events
    11. include_once 'mixpanel/tracking_file.php';
    12. }
  4. Update tools.php - change HEAD_SCRIPT_HANDLER to any script you equeued with wp_enqueue_script()
  5. Put all your tracking code into mixpanel/tracking_file.php