timothylhuillier/laravel-mixpanel
| Install | |
|---|---|
composer require timothylhuillier/laravel-mixpanel |
|
| PHP: | >=5.3.0 |
| License: | BSD-2-Clause |
| Last Updated: | Sep 12, 2015 |
| Links: | GitHub · Packagist |
laravel-mixpanel
In config.php add Timothylhuillier\LaravelMixpanel\LaravelMixpanelServiceProvider in the provider list and 'LaravelMixpanel' => 'Timothylhuillier\LaravelMixpanel\Facades\LaravelMixpanel' in aliases.
Then in terminal : php artisan config:publish timothylhuillier/laravel-mixpanel and add your token in app/config/package/timothylhuillier/laravel-mixpanel/config.php
In the config package the regex 'userAgent' => '^Mozilla((?!bot).)*$' skips all bot.
Now, to use this package, there is 2 solutions :
- You can use 'LaravelMixpanel::', ie.
LaravelMixpanel::track('Homepage View', ['connected' => false])
But with this solution, mixpanel people is unavailable. Then, I created getInstance().
- The second solution is to use
$mixpanel = LaravelMixpanel::getInstance();
For example :
<?php
$mixpanel = LaravelMixpanel::getInstance();
// identifie l'user
$mixpanel->identify($user->mixpanel_id);
// track l'event
$mixpanel->track("Upgraded account");
// MAJ de l'user dans la BDD de mixpanel
$mixpanel->people->set($user->mixpanel_id, array(
'$name' => $user->name,
'$phone' => $user->tel,
'$address' => $user->address,
'$lat' => $user->lat,
'$lng' => $user->lng,
));
Related Packages
laravel-paypalpayment is simple package help you process direct credit card paym...
Powerful PHP database abstraction layer (DBAL) with many features for database s...