analytics v0.6.0 Analytics.Mixpanel.Events

This module provides a struct that accumulates user events and helper to submit data to Mixpanel.

Link to this section Summary

Functions

Creates a new Events struct that is used to submit events for a client identified with distinct_id

The IP address associated with a given profile, which Mixpanel uses to guess user geographic location. Ignored if not set

Submits events tracked for a user

Appends an event to a Events struct with a pre-defined distinct_id

Appends an event to a Events struct with a specific distinct_id. This is useful when you want to submit events to more than user per request

Link to this section Functions

Link to this function new(distinct_id)

Creates a new Events struct that is used to submit events for a client identified with distinct_id.

Link to this function set_ip(batch_request, ip)

The IP address associated with a given profile, which Mixpanel uses to guess user geographic location. Ignored if not set.

Link to this function submit(batch_request)

Submits events tracked for a user.

Link to this function track(batch_request, event, properties \\ %{})

Appends an event to a Events struct with a pre-defined distinct_id.

Events struct must be created with new/1 in order to use this function.

Arguments

  • event - A name for the event;
  • properties - A collection of properties associated with this event. Where :time (timestamp) would update event time (otherwise Mixpanel uses time when event is arrived to their back-end), distinct_id can be used to identify user and :token can be used to override Mixpanel API key.
Link to this function track_for_user(batch_request, distinct_id, event, properties \\ %{})

Appends an event to a Events struct with a specific distinct_id. This is useful when you want to submit events to more than user per request.

Arguments

  • distinct_id - Distinct ID that identifies user on Mixpanel;
  • event - A name for the event;
  • properties - A collection of properties associated with this event. Where :time (timestamp) would update event time (otherwise Mixpanel uses time when event is arrived to their back-end), distinct_id can be used to identify user and :token can be used to override Mixpanel API key.