Skip to content

Commit fd88b98

Browse files
committed
Added configuration option for MixPanel Host.
1 parent 43594a2 commit fd88b98

File tree

8 files changed

+2448
-2041
lines changed

8 files changed

+2448
-2041
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
99
(This is already detected in subscription update.)
1010
- Filter any incoming web-hook events that are in test mode.
1111

12+
## [0.10.2] - 2020-08-05
13+
### Added
14+
- configuration option for MixPanel Host.
15+
1216
## [0.10.1] - 2020-03-04
1317
### Updated
1418
- Laravel dependency to release version.

README.md

+40-52
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# MixPanel for Laravel 5
1+
# MixPanel for Laravel
22

3-
[![Join the chat at https://gitter.im/GeneaLabs/laravel-mixpanel](https://badges.gitter.im/GeneaLabs/laravel-mixpanel.svg)](https://gitter.im/GeneaLabs/laravel-mixpanel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4-
[![Travis](https://img.shields.io/travis/GeneaLabs/laravel-mixpanel.svg)](https://travis-ci.org/GeneaLabs/laravel-mixpanel)
53
[![Scrutinizer](https://img.shields.io/scrutinizer/g/GeneaLabs/laravel-mixpanel.svg)](https://scrutinizer-ci.com/g/GeneaLabs/laravel-mixpanel)
64
[![Coveralls](https://img.shields.io/coveralls/GeneaLabs/laravel-mixpanel.svg)](https://coveralls.io/github/GeneaLabs/laravel-mixpanel)
75
[![GitHub (pre-)release](https://img.shields.io/github/release/GeneaLabs/laravel-mixpanel/all.svg)](https://github.com/GeneaLabs/laravel-mixpanel)
@@ -20,70 +18,59 @@
2018
Blade template use.
2119

2220
## Requirements and Compatibility
23-
- PHP >= 7.1.3
24-
- Laravel >= 5.5
21+
- PHP >= 7.2
22+
- Laravel >= 7.0
2523

2624
### Legacy Versions
2725
- [Laravel 5.2](https://github.com/GeneaLabs/laravel-mixpanel/tree/afcf3737412c1aebfa9dd1d7687001f78bdb3956)
2826
- [Laravel 5.0](https://github.com/GeneaLabs/laravel-mixpanel/tree/ce110ebd89658cbf8a91f2cfb5db57e2b449e7f3)
2927

3028
## Installation
31-
```sh
32-
composer require genealabs/laravel-mixpanel
33-
```
34-
35-
**Only if you are running Laravel 5.4 or below:**
36-
Add the service provider entry in `config\app.php`:
37-
```php
38-
GeneaLabs\LaravelMixpanel\Providers\Service::class,
39-
```
40-
41-
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+
```
6041

6142
## Configuration
6243
### 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.
6446
- `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.
7356
- `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.
7558

7659
## Upgrade Notes
7760
### 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.
8063

8164
### 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.
8369

8470
## 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.
8774
8875
Common user events are automatically recorded:
8976
- User Registration
@@ -111,7 +98,8 @@ class MyClass
11198
}
11299
```
113100
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:
115103
```php
116104
$mixPanel = app('mixpanel'); // using app helper
117105
$mixPanel = Mixpanel::getFacadeRoot(); // using facade
@@ -126,8 +114,8 @@ After that you can make the usual calls to the MixPanel API:
126114
And so on ...
127115
128116
### 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
131119
132120
Once that has been completed, exempt the web-hook endpoint from CSRF-validation
133121
in `/app/Http/Middleware/VerifyCsrfToken.php`:

config/services.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
return [
44
'mixpanel' => [
5-
'host' => 'api.mixpanel.com',
5+
'host' => env("MIXPANEL_HOST"),
66
'token' => env('MIXPANEL_TOKEN'),
77
'enable-default-tracking' => true,
88
'consumer' => 'socket',

0 commit comments

Comments
 (0)