CLI-based Tracking Plan Management Quickstart Alpha

Get started with creating and deploying a Tracking Plan using the Rudder CLI tool.
Available Plans
  • free
  • starter
  • growth
  • enterprise

This quickstart guide shows you how to use the Rudder CLI tool to create and deploy a Tracking Plan to your workspace.

info
See End-to-End Walkthrough for a detailed, step-by-step walkthrough of this feature.

Prerequisites

1. Authenticate the CLI tool

Run the following command and enter your access token when prompted:

rudder-cli auth login

2. Create a project directory

Create a project directory to store your Data Catalog YAML files:

mkdir ~/tutorial-catalog

3. Define events, properties, and custom types

Create the following YAML files in your project directory:

  • Events (~/tutorial-catalog/events.yaml)
version: rudder/0.1
kind: events
metadata:
  name: myevents
spec:
  events:
    - id: product_viewed
      name: "Product Viewed"
      event_type: track
      description: "Triggered when a user views a product"
      category:
        $ref: "#/categories/event-categories/browsing_category" # Reference to the Browsing category (see below)
  • Event categories (~/tutorial-catalog/event-categories.yaml)
version: rudder/v0.1
kind: categories
metadata:
  name: event-categories
spec:
  categories:
    - id: browsing_category
      name: Browsing
  • Properties (~/tutorial-catalog/properties.yaml)
version: rudder/v0.1
kind: properties
metadata:
  name: myproperties
spec:
  properties:
    - id: product_sku
      name: "SKU"
      type: string
      description: "Product SKU"
    - id: price
      name: "Price"
      type: integer
      description: "Product price"
info
See Nested properties for more information on defining and using nested properties in your Tracking Plans.
  • Custom Types (~/tutorial-catalog/custom-types.yaml)
success
You can also define Custom Type Variants in your custom type definitions that define different property requirements for reusable object types based on a discriminating property value.

4. Create a Tracking Plan

Create a Tracking Plan that references your events and properties (~/tutorial-catalog/tracking-plan.yaml):

version: rudder/0.1
kind: tp
metadata:
  name: ecomm-tracking-plan
spec:
  id: ecomm-tracking-plan
  display_name: "Product Tracking Plan"
  description: "Tracking plan for product-related events"
  rules:
    - type: event_rule
      id: product_viewed_rule
      event:
        $ref: "#/events/myevents/product_viewed"
      allow_unplanned: false
      properties:
        - $ref: "#/properties/myproperties/product_sku"
          required: true
        - $ref: "#/properties/myproperties/price"
          required: true
        - $ref: "#/properties/myproperties/user_profile" # Nested property of object type
          properties:
            - $ref: "#/properties/myproperties/user_profile/personal_info/first_name"
            - $ref: "#/properties/myproperties/user_profile/personal_info/last_name"
success
You can also define Event Rule Variants in your Tracking Plan that define dynamic event validation rules that adapt based on context.

5. Validate and deploy

  1. Validate your files:
rudder-cli tp validate -l ~/tutorial-catalog
  1. Optional: Review changes before deploying:
rudder-cli tp apply -l ~/tutorial-catalog --dry-run
  1. Deploy changes to your workspace:
rudder-cli tp apply -l ~/tutorial-catalog

Next steps



Questions? Contact us by email or on Slack