Segmentry.Analytics.Sender (segmentry v0.3.0)

Copy Markdown View Source

Alternative service implementation that sends every event as it is called. The HTTP call is made in a Task.start_link/1 so it does not block the GenServer; ordering is not guaranteed.

Segmentry.Analytics.Batcher should be preferred in production, but use this module when events must be as real-time as possible.

Summary

Functions

Send a Segment event immediately and asynchronously. Must be a Track, Identify, Screen, Alias, Group, or Page struct.

Returns a specification to start this module under a supervisor.

Start the GenServer with a Segment HTTP Source API write key.

Start the GenServer with a Segment HTTP Source API write key and a keyword list of Req options. Used in tests to inject a Req.Test plug stub.

Functions

call(event)

@spec call(Segmentry.segment_event()) :: :ok

Send a Segment event immediately and asynchronously. Must be a Track, Identify, Screen, Alias, Group, or Page struct.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(api_key)

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

Start the GenServer with a Segment HTTP Source API write key.

start_link(api_key, req_options)

@spec start_link(
  String.t(),
  keyword()
) :: GenServer.on_start()

Start the GenServer with a Segment HTTP Source API write key and a keyword list of Req options. Used in tests to inject a Req.Test plug stub.