keyteqlabs/li3_mixpanel

Lithium Mixpanel integration

Installs: 11

Dependents: 0

Watchers: 6

Forks: 2

Language: PHP

v1.0 2013-03-06 17:51 UTC

README

Lithium library for sending statistical data to Mixpanel.

Installation

Composer

{
  "require" : {
    "KeyteqLabs/li3_mixpanel" : "*"
  }
}
composer.phar install

Submodule

Add a submodule to your li3 libraries:

git submodule add git@github.com:KeyteqLabs/li3_mixpanel.git libraries/li3_mixpanel

Activate it

Add this to your app (config/bootstrap/libraries.php):

<?php
Libraries::add('li3_mixpanel', array(
    'token' => $token
));

Filtering track calls by environment

Send the env key when adding the library to only enable one or a set of environments. Passing * means enabling it for every environment.

<?php
Libraries::add('li3_mixpanel', array(
    'token' => $token,
    'env' => array('production', 'staging')
));

Sending data

<?php
Mixpanel::track('api.requests', $params['request']->params);
// Track revenue
Mixpanel::transaction($userId, $sum);
// Track people by identifying the person
Mixpanel::set($userId, array(
    '$name' => $user->name,
    '$username' => $user->username
));

Credits