Elixir library

Last updated:

This library was built by the community and is not maintained by the PostHog core team.

This library provides an Elixir HTTP client for PostHog. See the repository for more information.

Installation

The package can be installed by adding posthog to your list of dependencies in mix.exs:

def deps do
[
{:posthog, "~> 0.1"}
]
end

Configuration

config :posthog,
api_url: "<ph_instance_address>",
api_key: "<ph_project_api_key>"

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

Usage

Capturing events:

Posthog.capture("login", distinct_id: user.id)

Capturing multiple events:

Posthog.batch([{"login", [distinct_id: user.id], nil}])

Thanks

Thanks to whitepaperclip for contributing this library.