From 70d9fc9029d2569472f9c2550b7d128bfebd244f Mon Sep 17 00:00:00 2001 From: Deepak Neralla Date: Thu, 18 Oct 2018 00:08:34 -0700 Subject: [PATCH] adding user_id feild with every event and people updates --- lib/Producers/MixpanelEvents.php | 7 ++++--- lib/Producers/MixpanelPeople.php | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Producers/MixpanelEvents.php b/lib/Producers/MixpanelEvents.php index 3a76b2e..16cfaab 100644 --- a/lib/Producers/MixpanelEvents.php +++ b/lib/Producers/MixpanelEvents.php @@ -27,10 +27,10 @@ public function track($event, $properties = array()) { // if no time is passed in, use the current time if (!array_key_exists('time', $properties)) $properties['time'] = time(); - $params['event'] = $event; $params['properties'] = array_merge($this->_super_properties, $properties); + $this->enqueue($params); } @@ -120,7 +120,8 @@ public function getProperty($property) { * @param string|int $user_id */ public function identify($user_id) { - $this->register("distinct_id", $user_id); + $this->register('distinct_id', $user_id); + $this->register('$user_id', $user_id); } @@ -161,4 +162,4 @@ public function createAlias($original_id, $new_id) { function _getEndpoint() { return $this->_options['events_endpoint']; } -} \ No newline at end of file +} diff --git a/lib/Producers/MixpanelPeople.php b/lib/Producers/MixpanelPeople.php index bf7d431..d7f3089 100644 --- a/lib/Producers/MixpanelPeople.php +++ b/lib/Producers/MixpanelPeople.php @@ -18,6 +18,7 @@ private function _constructPayload($distinct_id, $operation, $value, $ip = null, $payload = array( '$token' => $this->_token, '$distinct_id' => $distinct_id, + '$user_id' => $distinct_id, $operation => $value ); if ($ip !== null) $payload['$ip'] = $ip;