# `PrivatusAnalytics.Config`
[🔗](https://github.com/Privatus-Analytics/elixir/blob/v1.0.0/lib/privatus_analytics/config.ex#L1)

Reads the settings for the tracking script.

Settings come from three places. The first one found wins:

  1. Options passed to the call (for example `PrivatusAnalytics.tag(modules: ["engage"])`).
  2. Application config, `config :privatus_analytics, ...`.
  3. Built-in defaults (and the `PRIVATUS_SITE_ID` and `PRIVATUS_SCRIPT_HOST`
     environment variables for the site id and script host).

## Which environments get the tag

`enabled: true` or `enabled: false` forces the tag on or off. When `enabled`
is not set, the tag prints only when the current environment is in
`enabled_environments` (default `[:prod]`). The current environment is:

  * the `:env` setting, if you set it (we recommend
    `config :privatus_analytics, env: config_env()` in `config/config.exs`),
  * else `Mix.env()` when Mix is running (`mix phx.server`, `mix test`),
  * else `:prod`. Mix is not part of a release, so a release counts as production.

# `default_host`

The tracker origin used when nothing else is set.

# `enabled?`

Whether the tag should print for these options.

# `env`

The environment used to decide if the tag prints. See the module docs.

# `script_host`

The origin that serves `/js/pa.js`, without a trailing slash.

# `site_id`

The site id (starts with `pa_`), or nil. Falls back to `PRIVATUS_SITE_ID`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
