Skip to content

opentp.yaml

The main configuration file defines your tracking plan structure, taxonomy, transforms, and validation checks.

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: true
FieldTypeRequiredDescription
opentpstringYesFormat version (e.g., “2025-12”)
infoobjectYesProject metadata
specobjectYesTracking plan specification
info:
title: My Tracking Plan
version: 1.0.0
description: Analytics events for My App
contact:
- Analytics Team <[email protected]>
FieldTypeRequiredDescription
titlestringYesProject name
versionstringYesProject version
descriptionstringNoProject description
contactarrayNoContact information
spec:
paths:
events:
root: /events
pattern: "{area}/{event}.yaml"
dictionaries:
root: /dictionaries
FieldTypeDescription
rootstringBase directory for events
patternstringFile 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.

FieldTypeDescription
rootstringBase directory for dictionaries
(no other fields)Dictionary paths are resolved as <root>/<dict>.yaml
spec:
events:
key:
pattern: "{area}::{event}"

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:

# Simple
pattern: "{area}::{event}"
# Result: auth::login_click
# With transform
pattern: "{area | slug}::{event | slug}"
# Result: auth::login_click (lowercase, underscores)

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: true

Each taxonomy field can have:

FieldTypeDescription
titlestringDisplay name
typestringstring, number, or boolean
descriptionstringField description
requiredbooleanWhether field is required
dictstringReference to a dictionary
enumarrayInline allowed values
patternstringPattern for composite fields (used with fragments)
fragmentsobjectFragment definitions for composite fields
checksobjectValidation checks

Notes:

  • enum values must match the field type (string, number, or boolean).
  • enum and dict are 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: true

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: false

Define target groups:

targets:
all: [web, ios, android] # Required: defines all targets
mobile: [ios, android] # Optional alias
desktop: [web] # Optional alias

Shared payload field definitions:

schema:
event_name:
type: string
required: true
application_id:
type: string
dict: data/application_id

Event 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.

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.kind and/or pii.masker when pii is 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.kind and pii.masker, enum and dict are mutually exclusive.
  • For pii.schema fields, enum values must match type, and enum and dict are mutually exclusive.

Define reusable transform pipelines:

transforms:
slug:
- lower
- trim
- replace:
from: " "
to: "_"
- truncate: 160

Each transform step is either:

  • a string step name (lower)
  • a single-key object with parameters (replace: { from: " ", to: "_" }, truncate: 160)