Skip to content

Commit 84c2f2b

Browse files
committed
Add name, referrer, referring_domain to be tracked
1 parent b04fba4 commit 84c2f2b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1111
(This is already detected in subscription update.)
1212
- Filter any incoming webhook events that are in test mode.
1313

14-
## [0.4.7] - 25 Oct 2015
14+
## [0.4.7 - 0.4.8] - 25 Oct 2015
15+
### Added
16+
- tracking of `name` in addition to `first name` and `last name`.
17+
- tracking of `referrer` and `referring domain` to help get additional information for Live View (may not yet work
18+
fully).
19+
1520
### Fixed
1621
- improper tracking of user details, which caused users' names to be blank and a `0 Object [object]` field to be tracked
1722
erroneously.

src/Listeners/LaravelMixpanelEventHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function onUserLogin(Model $user)
6060
$data = [
6161
'$first_name' => $firstName,
6262
'$last_name' => $lastName,
63+
'$name' => $user->name,
6364
'$email' => $user->email,
6465
];
6566

@@ -104,8 +105,9 @@ public function onViewLoad($route)
104105

105106
$data['Url'] = $request->getUri();
106107
$data['Referrer'] = $request->header('referer');
108+
$data['$initial_referrer'] = $request->header('referer');
109+
$data['$initial_referring_domain'] = parse_url($request->header('referer'))['host'];
107110
array_filter($data);
108-
109111
$this->mixPanel->track('Page View', $data);
110112
}
111113

src/Listeners/LaravelMixpanelUserObserver.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public function created(Model $user)
3636
$data = [
3737
'$first_name' => $firstName,
3838
'$last_name' => $lastName,
39+
'$name' => $user->name,
40+
'$email' => $user->email,
3941
];
4042

4143
if ($user->created_at) {
@@ -68,6 +70,7 @@ public function saving(Model $user)
6870
$data = [
6971
'$first_name' => $firstName,
7072
'$last_name' => $lastName,
73+
'$name' => $user->name,
7174
'$email' => $user->email,
7275
];
7376

0 commit comments

Comments
 (0)