opentp.yaml
opentp.yaml
Section titled “opentp.yaml”The main configuration file defines your tracking plan structure, taxonomy, transforms, and validation checks.
Minimal Example
Section titled “Minimal Example”opentp: 2025-12
info: title: My Tracking Plan version: 1.0.0
spec: paths: events: root: /events pattern: "{area}/{event}.yaml"
events: key: pattern: "{area}::{event}" taxonomy: area: title: Area type: string required: true event: title: Event type: string required: true action: title: Action type: string required: true payload: targets: all: [web, ios, android] schema: event_name: type: string required: trueFull Reference
Section titled “Full Reference”Root Fields
Section titled “Root Fields”| Field | Type | Required | Description |
|---|---|---|---|
opentp | string | Yes | Format version (e.g., “2025-12”) |
info | object | Yes | Project metadata |
spec | object | Yes | Tracking plan specification |
info: title: My Tracking Plan version: 1.0.0 description: Analytics events for My App contact:| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Project name |
version | string | Yes | Project version |
description | string | No | Project description |
contact | array | No | Contact information |
spec.paths
Section titled “spec.paths”spec: paths: events: root: /events pattern: "{area}/{event}.yaml" dictionaries: root: /dictionariespaths.events
Section titled “paths.events”| Field | Type | Description |
|---|---|---|
root | string | Base directory for events |
pattern | string | File path pattern using taxonomy fields |
Fields used in spec.paths.events.pattern are extracted from the event file path and added to event.taxonomy.
If a field is present in the path pattern, it does not need to be duplicated inside the event YAML.
paths.dictionaries
Section titled “paths.dictionaries”| Field | Type | Description |
|---|---|---|
root | string | Base directory for dictionaries |
| (no other fields) | Dictionary paths are resolved as <root>/<dict>.yaml |
spec.events
Section titled “spec.events”spec: events: key: pattern: "{area}::{event}"key.pattern
Section titled “key.pattern”Defines how event keys are generated from taxonomy values.
- Use
{field}to insert a taxonomy field - Use
{field | transform}to apply a transform - Use
::or any separator between parts
Examples:
# Simplepattern: "{area}::{event}"# Result: auth::login_click
# With transformpattern: "{area | slug}::{event | slug}"# Result: auth::login_click (lowercase, underscores)spec.events.taxonomy
Section titled “spec.events.taxonomy”Defines metadata fields for organizing events.
taxonomy: area: title: Area type: string dict: taxonomy/areas required: true checks: max-length: 50 event: title: Event type: string required: true action: title: Action type: string description: Human-readable description of when event fires required: trueEach taxonomy field can have:
| Field | Type | Description |
|---|---|---|
title | string | Display name |
type | string | string, number, or boolean |
description | string | Field description |
required | boolean | Whether field is required |
dict | string | Reference to a dictionary |
enum | array | Inline allowed values |
pattern | string | Pattern for composite fields (used with fragments) |
fragments | object | Fragment definitions for composite fields |
checks | object | Validation checks |
Notes:
enumvalues must match the fieldtype(string,number, orboolean).enumanddictare mutually exclusive.
checks is a free-form map of checkId -> params. Check IDs do not require any special prefix.
To avoid collisions across teams, use a consistent namespace (for example mycompany.* or myteam-*).
Tooling may warn or error on unknown check IDs depending on configuration.
Composite taxonomy fields (pattern + fragments)
Section titled “Composite taxonomy fields (pattern + fragments)”For a composite field, define a pattern and a fragments map to extract and validate individual parts.
Fragment values are exposed as additional taxonomy keys (for example taxonomy.verb, taxonomy.object).
taxonomy: action: title: Action type: string required: true pattern: "{verb} - {object}" fragments: verb: title: Verb type: string required: true object: title: Object type: string required: truespec.events.payload
Section titled “spec.events.payload”Defines data sent to analytics targets.
payload: targets: all: [web, ios, android] mobile: [ios, android] schema: event_name: type: string required: true event_category: type: string required: falsetargets
Section titled “targets”Define target groups:
targets: all: [web, ios, android] # Required: defines all targets mobile: [ios, android] # Optional alias desktop: [web] # Optional aliasschema
Section titled “schema”Shared payload field definitions:
schema: event_name: type: string required: true application_id: type: string dict: data/application_idEvent files concretize these fields under event.payload.*.schema and can override specific properties (for example set a fixed value).
See docs/schema/events.md for the recommended merge rules.
spec.events.pii
Section titled “spec.events.pii”Configure PII metadata validation and masking conventions for payload fields.
In event payload field definitions, you can add:
pii.kind(string, reserved) — what kind of PII the field contains (e.g.email,user_id)pii.masker(string, reserved) — masker implementation id- Any additional
pii.*keys for governance metadata (owner, tickets, notes, etc)
This section lets you:
- Require
pii.kindand/orpii.maskerwhenpiiis present - Restrict their values using dictionaries or checks
- Define additional PII metadata fields and validate them (via tooling)
Maskers are tool-defined. The specification defines a built-in masker id star that replaces the value with asterisks.
Additional maskers can be provided by tooling.
pii: kind: required: true dict: governance/pii-kinds masker: required: false schema: owner: type: string dict: governance/pii-owners required: true jira: type: string required: true checks: pattern: "^[A-Z]+-[0-9]+$"Notes:
- For
pii.kindandpii.masker,enumanddictare mutually exclusive. - For
pii.schemafields,enumvalues must matchtype, andenumanddictare mutually exclusive.
spec.transforms
Section titled “spec.transforms”Define reusable transform pipelines:
transforms: slug: - lower - trim - replace: from: " " to: "_" - truncate: 160Each transform step is either:
- a string step name (
lower) - a single-key object with parameters (
replace: { from: " ", to: "_" },truncate: 160)