public function testGetInstance() { $instance = Mixpanel::getInstance("token"); $this->assertInstanceOf("Mixpanel", $instance); $this->assertEquals($this->_instance, $instance); $this->assertInstanceOf("Producers_MixpanelPeople", $this->_instance->people); }
/** * Call any method of the Mixpanel class * @param string $method_name * @param mixed $args * @return mixed */ public function __call($method_name, $args) { if (!$this->is_enabled()) { return false; } return call_user_func_array(array(Mixpanel::getInstance($this->_key, $this->_options), $method_name), $args); }
private function initMxPanel() { if ($this->mp) { return; } require_once dirname(__FILE__) . '/lib/mixpanel/Mixpanel.php'; $this->mp = Mixpanel::getInstance($this->mixpanel_token, array('use_ssl' => false)); }
function track($event, $data) { if (file_exists(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php')) { require_once realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php'; $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263"); $domain = str_replace("http://", "", $_SERVER["SERVER_NAME"]); $mp->track($event, $data); } }
/** * Tracks an event using the Mixpanel API if the user opted into tracking. * Example: dh_ptp_track_event("add to cart clicked", array("label" => "sign-up")); * * @param string $dh_ptp_event [The name of the event that is being fired.] * @param array $dh_ptp_properties [Additional properties to track. (optional)] */ function dh_ptp_track_event($dh_ptp_event, $dh_ptp_properties = array()) { // only track events if the user agreed $dh_ptp_usage_tracking = get_option('dh_ptp_allow_tracking'); if ($dh_ptp_usage_tracking == 'yes') { // get the Mixpanel class instance $mp = Mixpanel::getInstance("1064083f4aaf3eed31d0fdf1c308365c"); // Set user id: site url = (url + site name) encoded $user_id = base64_encode(site_url() . ' ' . get_bloginfo('name')); // associate user to all subsequent track calls $mp->identify($user_id); // track the event $mp->track($dh_ptp_event, $dh_ptp_properties); } }
/** * Track plugin activity in MixPanel * * @param string * * @return array */ function inboundrocket_track_plugin_activity($activity_desc, $custom_properties = array()) { if (!function_exists('curl_init')) { return false; } $inboundrocket_user = inboundrocket_get_current_user(); global $wp_version; global $current_user; get_currentuserinfo(); $user_id = md5(get_site_url()); $plugins = wp_get_active_and_valid_plugins(); $default_properties = array("distinct_id" => $user_id, '$wp-url' => get_site_url(), '$wp-version' => $wp_version, '$ir-version' => INBOUNDROCKET_PLUGIN_VERSION, '$wp-plugins' => $plugins); $properties = array_merge((array) $default_properties, (array) $custom_properties); $mp = Mixpanel::getInstance(INBOUNDROCKET_MIXPANEL_PROJECT_TOKEN, array("debug" => true)); $mp->track($activity_desc, $properties); return true; }
public function __construct() { $mp = $this->getMixpanel(); $mp = Mixpanel::getInstance("PLACE_YOUR_TOKEN_HERE"); $this->setMixpanel($mp); }
function ml_track_mixpanel($action) { if (function_exists('curl_version')) { // get the Mixpanel class instance, replace with your project token $mp = Mixpanel::getInstance("3e7cc38a0abe4ea3a16a0e7538144f23"); // track an event $mp->track($action); } }
function track($data) { mlog('track'); if (file_exists(realpath(dirname(__FILE__)) . '/libs/mixpanel/Mixpanel.php')) { require_once realpath(dirname(__FILE__)) . '/libs/mixpanel/Mixpanel.php'; $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263"); $domain = str_replace("http://", "", $_SERVER["SERVER_NAME"]); switch ($data['type']) { case 'activate': $mp->track("Activate - Plugin", array("domain" => $domain)); break; case 'deactivate': $mp->track("Deactivate - Plugin", array("domain" => $domain)); break; default: if (isset($data['event'])) { $mp->track($data['event'], array("domain" => $domain)); } break; } } $response = wp_remote_post(SK_TRACKING_API . 'event', array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $data, 'cookies' => array())); }
function ml_track_mixpanel($action) { if (function_exists(base64_decode('Y3VybF92ZXJzaW9u'))) { $mp = Mixpanel::getInstance(base64_decode('M2U3Y2MzOGEwYWJlNGVhM2ExNmEwZTc1MzgxNDRmMjM=')); $mp->track($action); } }
<?php // import the Mixpanel class require_once "../lib/Mixpanel.php"; // instantiate the Mixpanel class $mp = Mixpanel::getInstance("MIXPANEL_PROJECT_TOKEN"); // associate a user id to subsequent events $mp->identify(12345); // track a "Login Success" event with a property "Ad Source" having value "Google" $mp->track("Login Success", array("Ad Source" => "Google")); // track an "Item Viewed" event with a property "Item" having value "Cool New Shoes" $mp->track("Item Viewed", array("Item" => "Cool New Shoes")); // stop associating events to user 12345 $mp->unregister("distinct_id"); // event "Some Event" won't be associated with user 12345 $mp->track("Some Event");
public function testing() { // $this->load->model('Purchase'); // $purchase = $this->Purchase->get_details('49f463320a796a9a443157780d29d585'); // dumper($purchase['item_download_link']); require 'application/libraries/Mixpanel/Mixpanel.php'; // dumper(scandir('./application/libraries/Mixpanel')); // $this->load->library('Mixpanel/Mixpanel.php', 'a50829b5f6db182b5dafa61c12baa58b'); // get the Mixpanel class instance, replace with your // project token $mp = Mixpanel::getInstance("a50829b5f6db182b5dafa61c12baa58b"); // track an event // $mp->identify('*****@*****.**'); dumper($mp->track("testing library", array("label" => "dev-test"))); }
public function __construct() { self::$mixpanel = Mixpanel::getInstance($_ENV['MIXPANEL_TOKEN']); }
function track_comment_posted_event() { $string = phpversion(); if (substr($string, 0, 1) === '5') { // get the Mixpanel class instance, replace with your project token $mp = Mixpanel::getInstance("d6943462b143b3727b42a1f59c2e27e7"); // track an event $result = $mp->track('Comment Posted', array("plugin_name" => "gplus_comments", "site_domain" => home_url(), "php_version" => phpversion())); } return $result; }