Segment.Analytics.Sender (segment v0.2.7) View Source

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 implementation 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 asynchronously

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

Specs

call(Segment.segment_event()) :: :ok

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 asynchronously

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

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)

View Source

Specs

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.