Package Version Hex Docs


This library has been designed to be independent of whatever HTTP request library or runtime you choose or wish to use, and you can install for all targets by running:

gleam add plunk


import gleam/erlang/os
import gleam/io
import gleam/json
import gleam/result
import gleam/hackney
import plunk
import plunk/event.{Event}

pub fn main() {
  let key =
    |> result.unwrap("")

  let assert Ok(resp) =
    |> event.track(Event(
      event: "your-event",
      email: "",
      data: [#("name", json.string("John"))],
    |> hackney.send

  let assert Ok(e) = event.decode(resp)

See documentation for each module on Hexdocs or go through the test folder for examples.


To run tests locally, you need to add your Plunk API key to the environment variables like this:

export PLUNK_API_KEY="sk_..."

NOTE: tests are designed to run only in the BEAM runtime (erlang target) as they depend on hackney

Search Document