README.md

# TelemetryDeck for Elixir

Elixir client for [TelemetryDeck](https://telemetrydeck.com) Ingest API v2.

This package sends privacy-conscious analytics signals to TelemetryDeck from Elixir applications. It is intentionally small: build a config, build a signal, and send one signal or a batch of signals.

## Installation

Add `telemetry_deck` to your dependencies:

```elixir
def deps do
  [
    {:telemetry_deck, "~> 0.1"}
  ]
end
```

## Usage

```elixir
config =
  TelemetryDeck.Config.new!(
    namespace: "your-namespace",
    app_id: "AAAA-BBBB"
  )

signal =
  TelemetryDeck.Signal.new!(
    type: "App.User.signedIn",
    client_user: TelemetryDeck.Hash.client_user("user-123", "your-secret"),
    payload: %{"App.Plan.name" => "pro"}
  )

TelemetryDeck.Client.send(config, signal)
```

## Batching

```elixir
TelemetryDeck.Client.send_batch(config, [signal_one, signal_two])
```

## Configuration

`TelemetryDeck.Config` accepts:

- `:namespace` - your TelemetryDeck namespace.
- `:app_id` - your TelemetryDeck app ID.
- `:endpoint` - optional custom ingestion endpoint. Defaults to `https://nom.telemetrydeck.com`.
- `:is_test_mode` - marks signals as test signals when true.
- `:request_fun` - optional two-arity request function for tests or custom HTTP behavior.

## Privacy

TelemetryDeck expects `clientUser` to be a stable hash. You can pass an already-hashed value, or use `TelemetryDeck.Hash.client_user/2` to create an HMAC-SHA256 hash from your own identifier and secret.

Payloads should be flat maps of primitive values. Nested maps and lists are rejected so signals stay compatible with TelemetryDeck Ingest API v2.

## Publishing Checklist

Before publishing a release:

```sh
mix test
mix docs
mix hex.build --unpack
mix hex.publish --dry-run
```

Then publish with:

```sh
mix hex.publish
```

## License

MIT