posthog v0.3.0 Posthog

This module provides an Elixir HTTP client for Posthog.

Example config:

config :posthog,
  api_url: "http://posthog.example.com",
  api_key: "..."

Optionally, you can pass in a :json_library key. The default JSON parser is Jason.

Link to this section Summary

Functions

See Posthog.Client.batch/2.

Sends a capture event. distinct_id is the only required parameter.

See Posthog.Client.feature_flags/2.

Link to this section Functions

Link to this function

batch(events, opts \\ [])

Specs

batch(
  [tuple()],
  keyword()
) :: result()

See Posthog.Client.batch/2.

Link to this function

capture(event, params, opts \\ [])

Specs

capture(atom() | String.t(), keyword() | map(), keyword() | timestamp()) ::
  result()

Sends a capture event. distinct_id is the only required parameter.

Examples

iex> Posthog.capture("login", distinct_id: user.id)
:ok
iex> Posthog.capture("login", [distinct_id: user.id], DateTime.utc_now())
:ok
iex> Posthog.capture("login", [distinct_id: user.id], [headers: [{"x-forwarded-for", "127.0.0.1"}]])
Link to this function

feature_flag(flag, distinct_id, opts \\ [])

Specs

feature_flag(binary(), binary(), keyword()) :: result()
Link to this function

feature_flag_enabled?(flag, distinct_id, opts \\ [])

Specs

feature_flag_enabled?(binary(), binary(), keyword()) :: boolean()
Link to this function

feature_flags(distinct_id, opts \\ [])

Specs

feature_flags(
  binary(),
  keyword()
) :: result()

See Posthog.Client.feature_flags/2.