Skip to main content
Traffical’s config-as-code lives in a .traffical/ directory at the root of your repository. The CLI reads and writes these files and syncs them with the platform. This page is the reference for the file formats; see the CLI page for the commands that act on them.

The .traffical/ directory

The CLI searches for the config starting in the current directory and walking up the tree, so commands work from any subfolder of your repo. Point at a non-default path with traffical --config <path>.
Legacy layout. A single traffical.yaml at the repo root is still parsed for backwards compatibility, as is a project: block inside config.yaml. Both are deprecated in favour of the .traffical/ directory and a dedicated project.yaml. New projects scaffolded by traffical init use the layout above.

config.yaml

The main file. It declares parameters, events, and reusable property groups. Everything declared here becomes synced when you traffical push — its definition turns read-only in the dashboard to prevent drift between your repo and the platform.

Top-level fields

Flat vs. grouped. You can declare a parameter either as a fully-qualified key under parameters (checkout.button.color) or as a local key inside a namespaces: block. They’re equivalent — traffical pull writes the grouped form, but both are accepted on read.

Parameters

A parameter is a typed value with a default. See the concept page for how parameters relate to layers and policies.

Parameter fields

Constraints

Constraints are enforced at edit time (in the dashboard and on traffical push), not at SDK resolution.

Events

Event definitions describe the track events your application emits. They generate TypeScript types, let the edge validate incoming payloads, and mark which properties become warehouse dimensions and measures.

Event fields

schemaEnforcement controls validation: off skips it, warn accepts the event but returns warnings, reject drops invalid events before they reach the pipeline.

Property fields

Each entry under properties: is a field in Traffical’s YAML DSL, which compiles to JSON Schema internally. The same shape is used inside propertyGroups and for nested object/array fields.
Mark properties you’ll want to break experiment results down by with dimension: true, and numeric properties you’ll want to build metrics on with measure: true. Both feed the warehouse-native pipeline.

Property groups

Property groups are reusable schemas you can attach to many events with propertyGroups: [name]. They keep shared context (geo, device, session) defined once.

project.yaml

The repo → project link, written by traffical link (or traffical init). It records which Traffical project and organization this repository syncs with. Safe to commit — edit it via the CLI rather than by hand.

metrics.yaml

Optional. Defines metrics and warehouse fact sources as code. Synced with traffical push and imported with traffical import metrics.

Top-level fields

Fact source fields

Metric fields

Validation

Both config.yaml and metrics.yaml are validated against a JSON Schema on every read. Invalid files fail fast with the offending path and reason, e.g.:
traffical push --dry-run validates and prints the diff without writing anything to the platform.

Next steps

CLI

The commands that sync these files with Traffical.

Parameters

Typed values with defaults.

Events

Event definitions, schemas, and property groups.

Type-safe events

Generate types from your event definitions.