$people
$people : \Producers_MixpanelPeople
An instance of the MixpanelPeople class (used to create/update profiles)
This is the main class for the Mixpanel PHP Library which provides all of the methods you need to track events and create/update profiles.
This library is built such that all messages are buffered in an in-memory "queue" The queue will be automatically flushed at the end of every request. Alternatively, you can call "flush()" manually at any time. Flushed messages will be passed to a Consumer's "persist" method. The library comes with a handful of Consumers. The "CurlConsumer" is used by default which will send the messages to Mixpanel using forked cURL processes. You can implement your own custom Consumer to customize how a message is sent to Mixpanel. This can be useful when you want to put messages onto a distributed queue (such as ActiveMQ or Kestrel) instead of writing to Mixpanel in the user thread.
Option | Description | Default |
---|---|---|
max_queue_size | The maximum number of items to buffer in memory before flushing | 1000 |
debug | Enable/disable debug mode | false |
consumer | The consumer to use for writing messages | curl |
consumers | An array of custom consumers in the format array(consumer_key => class_name) | null |
host | The host name for api calls (used by some consumers) | api.mixpanel.com |
events_endpoint | The endpoint for tracking events (relative to the host) | /events |
people_endpoint | The endpoint for making people updates (relative to the host) | /engage |
use_ssl | Tell the consumer whether or not to use ssl (when available) | true |
error_callback | The name of a function to be called on consumption failures | null |
connect_timeout | In both the SocketConsumer and CurlConsumer, this is used for the connection timeout (i.e. How long it has take to actually make a connection). | 5 |
timeout | In the CurlConsumer (non-forked), it is used to determine how long the cURL call has to execute. | 30 |
$mp = Mixpanel::getInstance("MY_TOKEN");
$mp->track("My Event");
$mp = Mixpanel::getInstance("MY_TOKEN", array("use_ssl" => false));
$mp->people->set(12345, array( '$first_name' => "John", '$last_name' => "Doe", '$email' => "john.doe@example.com", '$phone' => "5555555555", 'Favorite Color' => "red" ));
$people : \Producers_MixpanelPeople
An instance of the MixpanelPeople class (used to create/update profiles)
$_events : \Producers_MixpanelEvents
An instance of the MixpanelEvents class
$_instances : array<mixed,\Mixpanel>
Instances' list of the Mixpanel class (for singleton use, splitted by token)
getInstance( $token, array $options = array()) : \Mixpanel
Returns a singleton instance of Mixpanel
$token | ||
array | $options |
identify(string|integer $user_id, [optional] string|integer $anon_id)
Identify the user you want to associate to tracked events. The $anon_id must be UUID v4 format and not already merged to an $identified_id. All identify calls with a new and valid $anon_id will trigger a track $identify event, and merge to the $identified_id.
string|integer | $user_id | |
string|integer | $anon_id |
register(string $property, mixed $value)
Register a property to be sent with every event.
If the property has already been registered, it will be overwritten. NOTE: Registered properties are only persisted for the life of the Mixpanel class instance.
string | $property | |
mixed | $value |
registerAll(array $props_and_vals = array())
Register multiple properties to be sent with every event.
If any of the properties have already been registered, they will be overwritten. NOTE: Registered properties are only persisted for the life of the Mixpanel class instance.
array | $props_and_vals |
registerAllOnce(array $props_and_vals = array())
Register multiple properties to be sent with every event.
If any of the properties have already been registered, they will NOT be overwritten. NOTE: Registered properties are only persisted for the life of the Mixpanel class instance.
array | $props_and_vals |
createAlias(string|integer $distinct_id, string|integer $alias)
An alias to be merged with the distinct_id. Each alias can only map to one distinct_id. This is helpful when you want to associate a generated id (such as a session id) to a user id or username.
string|integer | $distinct_id | |
string|integer | $alias |