You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-52
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
-
# MixPanel for Laravel 5
1
+
# MixPanel for Laravel
2
2
3
-
[](https://gitter.im/GeneaLabs/laravel-mixpanel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Verify that your auth configuration file `config/auth.php` has the user model
42
-
specified in `auth.providers.users.model` (or in `auth.model` for L5.1). If
43
-
that entry is missing, go ahead and add it.
44
-
```php
45
-
// Laravel 5.3
46
-
'providers' => [
47
-
'users' => [
48
-
'driver' => '...',
49
-
'model' => App\User::class,
50
-
],
51
-
52
-
// Laravel 5.1
53
-
'model' => App\User::class,
54
-
```
55
-
56
-
Lastly, add your Mixpanel token to your `.env` file:
57
-
```env
58
-
MIXPANEL_TOKEN=xxxxxxxxxxxxxxxxxxxxxx
59
-
```
29
+
1. Install the package:
30
+
```sh
31
+
composer require genealabs/laravel-mixpanel
32
+
```
33
+
2. Add your Mixpanel API Token to your `.env` file:
34
+
```env
35
+
MIXPANEL_TOKEN=xxxxxxxxxxxxxxxxxxxxxx
36
+
```
37
+
3. Add the MixPanel Host domain only if you need to change your MixPanel host from the default:
38
+
```env
39
+
MIXPANEL_TOKEN=xxxxxxxxxxxxxxxxxxxxxx
40
+
```
60
41
61
42
## Configuration
62
43
### Default Values
63
-
-`services.mixpanel.host`: (default: api.mixpanel.com) the api host to use.
44
+
- `services.mixpanel.host`: pulls the 'MIXPANEL_HOST' value from your `.env`
45
+
file.
64
46
- `services.mixpanel.token`: pulls the 'MIXPANEL_TOKEN' value from your `.env`
65
-
file.
66
-
-`services.mixpanel.enable-default-tracking`: (default: true) enable or disable Laravel user
67
-
event tracking.
68
-
-`services.mixpanel.consumer`: (default: socket) set the Guzzle adapter you want to use.
69
-
-`services.mixpanel.connect-timeout`: (default: 2) set the number of seconds after which
70
-
connections timeout.
71
-
-`services.mixpanel.timeout`: (default: 2) set the number of seconds after which event tracking
72
-
times out.
47
+
file.
48
+
- `services.mixpanel.enable-default-tracking`: (default: true) enable or disable
49
+
Laravel user event tracking.
50
+
- `services.mixpanel.consumer`: (default: socket) set the Guzzle adapter you
51
+
want to use.
52
+
- `services.mixpanel.connect-timeout`: (default: 2) set the number of seconds
53
+
after which connections timeout.
54
+
- `services.mixpanel.timeout`: (default: 2) set the number of seconds after
55
+
which event tracking times out.
73
56
- `services.mixpanel.data_callback_class`: (default: null) manipulate the data
74
-
being passed back to mixpanel for the track events.
57
+
being passed back to mixpanel for the track events.
75
58
76
59
## Upgrade Notes
77
60
### Version 0.7.0 for Laravel 5.5
78
-
- Remove the service provider from `/config/app.php`. The service provider is now
79
-
auto-discovered in Laravel 5.5.
61
+
- Remove the service provider from `/config/app.php`. The service provider is
62
+
now auto-discovered in Laravel 5.5.
80
63
81
64
### Page Views
82
-
- Page view tracking has been removed in favor of Mixpanels in-built Autotrack functionality, which tracks all page views. To turn it on, visit your Mixpanel dashboard, click *Applications > Autotrack > Web > etc.* and enable Autotracking.
65
+
- Page view tracking has been removed in favor of Mixpanels in-built Autotrack
66
+
functionality, which tracks all page views. To turn it on, visit your
67
+
Mixpanel dashboard, click *Applications > Autotrack > Web > etc.* and enable
68
+
Autotracking.
83
69
84
70
## Usage
85
-
MixPanel is loaded into the IoC as a singleton. This means you don't have to manually call $mixPanel::getInstance() as
86
-
described in the MixPanel docs. This is already done for you in the ServiceProvider.
71
+
MixPanel is loaded into the IoC as a singleton. This means you don't have to
72
+
manually call $mixPanel::getInstance() as described in the MixPanel docs.
73
+
This is already done for you in the ServiceProvider.
87
74
88
75
Common user events are automatically recorded:
89
76
- User Registration
@@ -111,7 +98,8 @@ class MyClass
111
98
}
112
99
```
113
100
114
-
If DI is impractical in certain situations, you can also manually retrieve it from the IoC:
101
+
If DI is impractical in certain situations, you can also manually retrieve it
102
+
from the IoC:
115
103
```php
116
104
$mixPanel = app('mixpanel'); // using app helper
117
105
$mixPanel = Mixpanel::getFacadeRoot(); // using facade
@@ -126,8 +114,8 @@ After that you can make the usual calls to the MixPanel API:
126
114
And so on ...
127
115
128
116
### Stripe Web-Hook
129
-
If you wish to take advantage of the Stripe web-hook and track revenue per user,
130
-
you should install Cashier: https://www.laravel.com/docs/5.5/billing
117
+
If you wish to take advantage of the Stripe web-hook and track revenue per
118
+
user, you should install Cashier: https://www.laravel.com/docs/5.5/billing
131
119
132
120
Once that has been completed, exempt the web-hook endpoint from CSRF-validation
0 commit comments