segment v0.2.0 Segment.Analytics.Sender

The Segment.Analytics.Sender service implementation is an alternative to the default Batcher to send every event as it is called. The HTTP call is made with an async Task to not block the GenServer. This will not guarantee ordering.

The Segment.Analytics.Batcher should be preferred in production but this module will emulate the implementaiton of the original library if you need that or need events to be as real-time as possible.

Link to this section Summary

Functions

Make a call to Segment with an event. Should be of type Track, Identify, Screen, Alias, Group or Page. This event will be sent immediately and asyncronously

Returns a specification to start this module under a supervisor.

Start the Segment.Analytics.Sender GenServer with an Segment HTTP Source API Write Key

Start the Segment.Analytics.Sender GenServer with an Segment HTTP Source API Write Key and a Tesla Adapter. This is mainly used for testing purposes to override the Adapter with a Mock.

Link to this section Functions

Make a call to Segment with an event. Should be of type Track, Identify, Screen, Alias, Group or Page. This event will be sent immediately and asyncronously

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_link(api_key)

start_link(String.t()) :: GenServer.on_start()

Start the Segment.Analytics.Sender GenServer with an Segment HTTP Source API Write Key

Link to this function

start_link(api_key, adapter)

start_link(String.t(), Tesla.adapter()) :: GenServer.on_start()

Start the Segment.Analytics.Sender GenServer with an Segment HTTP Source API Write Key and a Tesla Adapter. This is mainly used for testing purposes to override the Adapter with a Mock.