Mxpanel.Event (Mxpanel v0.3.0) View Source

Struct representing a Mixpanel Event

Link to this section Summary

Functions

Serialize a event into the format expected by the Mixpanel API.

Link to this section Types

Specs

t() :: %Mxpanel.Event{
  additional_properties: %{},
  distinct_id: term(),
  insert_id: String.t(),
  ip: nil | String.t(),
  name: String.t(),
  time: integer()
}

Link to this section Functions

Link to this function

new(name, distinct_id, additional_properties \\ %{}, opts \\ [])

View Source

Specs

new(String.t(), String.t(), map(), Keyword.t()) :: t()

Create a new event.

Mxpanel.Event.new("signup", "13793")
Mxpanel.Event.new("signup", "13793", %{"Favourite Color" => "Red"})
Mxpanel.Event.new("signup", "13793", %{}, ip: "72.229.28.185")
Mxpanel.Event.new("signup", "13793", %{}, time: 1624811298)

Options

  • :time - Specific timestamp in seconds of the event. Defaults to System.os_time(:second).

  • :ip - IP address to get automatic geolocation info.

Specs

serialize(t(), String.t()) :: map()

Serialize a event into the format expected by the Mixpanel API.