| Package Data | |
|---|---|
| Maintainer Username: | timothylhuillier |
| Maintainer Contact: | timothy.lhuillier@gmail.com (Timothy L'HUILLIER) |
| Package Create Date: | 2014-02-12 |
| Package Last Update: | 2015-09-12 |
| Home Page: | |
| Language: | PHP |
| License: | BSD-2-Clause |
| Last Refreshed: | 2025-12-11 03:07:36 |
| Package Statistics | |
|---|---|
| Total Downloads: | 5,192 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 8 |
| Total Watchers: | 2 |
| Total Forks: | 8 |
| Total Open Issues: | 0 |
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 :
LaravelMixpanel::track('Homepage View', ['connected' => false])
But with this solution, mixpanel people is unavailable. Then, I created getInstance().
$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,
));