segment v0.2.0 Segment.Analytics
The Segment.Analytics
module is the easiest way to send Segment events and provides convenience methods for track
, identify,
screen
, alias
, group
, and page
calls
The functions will then delegate the call to the configured service implementation which can be changed with:
config :segment, sender_impl: Segment.Analytics.Batcher,
By default (if no configuration is given) it will use Segment.Analytics.Batcher
to send events in a batch periodically
Link to this section Summary
Functions
alias
is how you associate one identity with another with properties defined in the Segment.Analytics.Alias
struct
alias
is how you associate one identity with another. alias/3
takes a user_id
and a previous_id
to map from. It also takes an optional Segment.Analytics.Context
struct.
The group
call is how you associate an individual user with a group with the properties in the defined in the Segment.Analytics.Group
struct
The group
call is how you associate an individual user with a group. group/4
takes a user_id
and a group_id
to associate it with. It also takes optional traits
of the group and
an optional Segment.Analytics.Context
struct.
identify
lets you tie a user to their actions and record traits about them as defined in the
Segment.Analytics.Identify
struct
identify
lets you tie a user to their actions and record traits about them. identify/3
takes a user_id
, optional additional traits
and an optional Segment.Analytics.Context
struct.
The page
call lets you record whenever a user sees a page of your website with the properties defined in the Segment.Analytics.Page
struct
The page
call lets you record whenever a user sees a page of your website. page/4
takes a user_id
and an optional page_name
, optional properties and an optional
Segment.Analytics.Context` struct.
See https://segment.com/docs/spec/page/
screen
let you record whenever a user sees a screen of your mobile app with properties defined in the
Segment.Analytics.Screen
struct
screen
let you record whenever a user sees a screen of your mobile app. screen/4
takes a user_id
, an optional screen_name
, optional properties
and an optional Segment.Analytics.Context
struct.
Make a call to Segment with an event. Should be of type Track, Identify, Screen, Alias, Group or Page
track
lets you record the actions your users perform. Every action triggers what Segment call an “event”, which can also have associated properties as defined in the
Segment.Analytics.Track
struct
track
lets you record the actions your users perform. Every action triggers what Segment call an “event”, which can also have associated properties. track/4
takes a user_id
, an
event_name
, optional additional properties
and an optional Segment.Analytics.Context
struct.
Link to this section Types
Link to this section Functions
alias
is how you associate one identity with another with properties defined in the Segment.Analytics.Alias
struct
alias(user_id, previous_id, context \\ Context.new())
alias(segment_id(), segment_id(), Segment.Analytics.Context.t()) :: :ok
alias
is how you associate one identity with another. alias/3
takes a user_id
and a previous_id
to map from. It also takes an optional Segment.Analytics.Context
struct.
The group
call is how you associate an individual user with a group with the properties in the defined in the Segment.Analytics.Group
struct
group(user_id, group_id, traits \\ %{}, context \\ Context.new())
group(segment_id(), segment_id(), map(), Segment.Analytics.Context.t()) :: :ok
The group
call is how you associate an individual user with a group. group/4
takes a user_id
and a group_id
to associate it with. It also takes optional traits
of the group and
an optional Segment.Analytics.Context
struct.
identify
lets you tie a user to their actions and record traits about them as defined in the
Segment.Analytics.Identify
struct
identify(user_id, traits \\ %{}, context \\ Context.new())
identify(segment_id(), map(), Segment.Analytics.Context.t()) :: :ok
identify
lets you tie a user to their actions and record traits about them. identify/3
takes a user_id
, optional additional traits
and an optional Segment.Analytics.Context
struct.
The page
call lets you record whenever a user sees a page of your website with the properties defined in the Segment.Analytics.Page
struct
page(user_id, page_name \\ "", properties \\ %{}, context \\ Context.new())
page(segment_id(), String.t(), map(), Segment.Analytics.Context.t()) :: :ok
The page
call lets you record whenever a user sees a page of your website. page/4
takes a user_id
and an optional page_name
, optional properties and an optional
Segment.Analytics.Context` struct.
See https://segment.com/docs/spec/page/
screen
let you record whenever a user sees a screen of your mobile app with properties defined in the
Segment.Analytics.Screen
struct
screen(user_id, screen_name \\ "", properties \\ %{}, context \\ Context.new())
screen(segment_id(), String.t(), map(), Segment.Analytics.Context.t()) :: :ok
screen
let you record whenever a user sees a screen of your mobile app. screen/4
takes a user_id
, an optional screen_name
, optional properties
and an optional Segment.Analytics.Context
struct.
Make a call to Segment with an event. Should be of type Track, Identify, Screen, Alias, Group or Page
track
lets you record the actions your users perform. Every action triggers what Segment call an “event”, which can also have associated properties as defined in the
Segment.Analytics.Track
struct
track(user_id, event_name, properties \\ %{}, context \\ Context.new())
track(segment_id(), String.t(), map(), Segment.Analytics.Context.t()) :: :ok
track
lets you record the actions your users perform. Every action triggers what Segment call an “event”, which can also have associated properties. track/4
takes a user_id
, an
event_name
, optional additional properties
and an optional Segment.Analytics.Context
struct.