Mxpanel.Groups (Mxpanel v1.0.1) View Source

Functions to manipulate group profiles.

Shared Options

All of the functions in this module accept the following options:

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

Link to this section Summary

Functions

Deletes a group profile from Mixpanel.

Removes a specific value in a list property.

Updates or adds properties to a group profile. The profile is created if it does not exist.

Adds properties to a group only if the property is not already set. The profile is created if it does not exist.

Adds the specified values to a list property on a group profile and ensures that those values only appear once.

Unsets specific properties on the group profile.

Link to this section Functions

Link to this function

delete(group_key, group_id, opts \\ [])

View Source

Specs

Deletes a group profile from Mixpanel.

"Company"
|> Mxpanel.Groups.delete("Mixpanel")
|> Mxpanel.deliver(client)
Link to this function

remove_item(group_key, group_id, property, item, opts \\ [])

View Source

Specs

Removes a specific value in a list property.

"Company"
|> Mxpanel.Groups.remove_item("Mixpanel", "Items purchased", "t-shirt")
|> Mxpanel.deliver(client)
Link to this function

set(group_key, group_id, properties, opts \\ [])

View Source

Specs

Updates or adds properties to a group profile. The profile is created if it does not exist.

properties = %{"Address" => "1313 Mockingbird Lane"}

"Company"
|> Mxpanel.Groups.set("Mixpanel", properties)
|> Mxpanel.deliver(client)
Link to this function

set_once(group_key, group_id, properties, opts \\ [])

View Source

Specs

set_once(String.t(), String.t(), map(), Keyword.t()) :: Mxpanel.Operation.t()

Adds properties to a group only if the property is not already set. The profile is created if it does not exist.

properties = %{"Address" => "1313 Mockingbird Lane"}

"Company"
|> Mxpanel.Groups.set_once("Mixpanel", properties)
|> Mxpanel.deliver(client)
Link to this function

union(group_key, group_id, properties, opts \\ [])

View Source

Specs

Adds the specified values to a list property on a group profile and ensures that those values only appear once.

properties = %{"Items purchased" => ["socks", "shirts"], "Browser" => "ie"}

"Company"
|> Mxpanel.Groups.union("Mixpanel", properties)
|> Mxpanel.deliver(client)
Link to this function

unset(group_key, group_id, property_names, opts \\ [])

View Source

Specs

Unsets specific properties on the group profile.

property_names = ["Items purchased"]
"Company"
|> Mxpanel.Groups.unset("Mixpanel", property_names)
|> Mxpanel.deliver(client)