The .traffical/ directory and the config.yaml, project.yaml, and metrics.yaml file formats — every field and option.
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.
Repo → project link (org + project IDs), written by traffical link
Yes
metrics.yaml
Metric and fact-source definitions
Yes
traffical.generated.ts
TypeScript types from traffical generate-types
Usually
.gitignore
Created automatically to keep .env out of git
Yes
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.
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.
version: "1.0"# Parameters with no namespace prefixparameters: feature_enabled: type: boolean default: false description: Master toggle for the new feature# Namespace-grouped parameters (the format the CLI writes)namespaces: checkout: description: Checkout flow configuration parameters: button.color: # full key: checkout.button.color type: string default: "#1E6EFB" description: Primary button color on checkout show_trust_badges: type: boolean default: false pricing: parameters: discount_pct: # full key: pricing.discount_pct type: number default: 0 constraints: min: 0 max: 50events: purchase: valueType: currency unit: USD description: Completed purchasepropertyGroups: geo: description: Geographic context properties: country: { type: string, dimension: true }
Map of parameters with no namespace (may be empty {}).
namespaces
No
Namespace-grouped parameters — an alternative to flat parameters.
events
No
Event definitions.
propertyGroups
No
Reusable property schemas shared across events.
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.
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.
SchemaVer string (MODEL-REVISION-ADDITION, e.g. 1-0-0).
schemaEnforcement
No
off, warn, or reject. How the edge handles payloads that violate the schema.
schemaEnforcement controls validation: off skips it, warn accepts the event but returns warnings, reject drops invalid events before they reach the pipeline.
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.
Field
Applies to
Description
type
all
string, number, integer, boolean, array, or object. Required.
required
all
Whether the property must be present on the event.
description
all
Free-form text.
enum
scalar
Allowed values.
pattern
string
Regex the value must match.
format
string
date-time, email, uri, or uuid.
minimum / maximum
number
Numeric bounds.
minLength / maxLength
string
String length bounds.
default
all
Default value for documentation/codegen.
examples
all
Example values for documentation.
dimension
all
Extract as a warehouse dimension for slicing metrics.
measure
number
Extract as an additional fact measure for metric creation.
measureDisplayName
number
Display name for the measure in the dashboard.
desiredDirection
number
increase or decrease — which way is “good” for this measure.
warehouseType
all
Override the auto-inferred warehouse column type.
items
array
Schema for array items (a nested property field).
minItems / maxItems
array
Array length bounds.
properties
object
Nested property fields.
additionalProperties
object
Whether extra keys are allowed on nested objects.
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 are reusable schemas you can attach to many events with propertyGroups: [name]. They keep shared context (geo, device, session) defined once.
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.
# Traffical project link — managed by `traffical link`.version: "1.0"org: id: org_DqQZGfRs key: acmeproject: id: proj_ST6qGDbR key: mahally