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. Review the YAML reference
Before defining your Data Catalog resources, review the Project YAML Reference to understand:
The complete YAML structure for events, properties, custom types, and Tracking Plans
Required and optional fields for each resource type
Validation rules and constraints
Reference syntax for linking resources together
Understanding the YAML reference will help you create properly structured files and avoid common validation errors when defining your resources.
4. Define events, properties, and custom types
Create the following YAML files in your project directory:
Events (~/tutorial-catalog/events.yaml)
version:rudder/v0.1kind:eventsmetadata:name:myeventsspec:events:- id:product_viewedname:"Product Viewed"event_type:trackdescription:"Triggered when a user views a product"category:"#/categories/event-categories/browsing_category"# Reference to the Browsing category (see below)- id:user_identifyevent_type:identifydescription:"Captures user profile information"category:"#/categories/event-categories/signup_category"- id:homepage_viewedevent_type:pagedescription:"Tracks homepage views"category:"#/categories/event-categories/browsing_category"
version:rudder/v0.1kind:custom-typesmetadata:name:identifier-typesspec:types:- id:sku_typename:"SKUType"description:"Custom type for SKU validation"type:stringconfig:# Validation rules for the custom data typeminLength:5maxLength:255pattern:"^SKU-[0-9]+$"
version:rudder/v0.1kind:propertiesmetadata:name:mypropertiesspec:properties:- id:product_skuname:"SKU"type:"#/custom-types/identifier-types/sku_type"# Reference to custom typedescription:"Product SKU"
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.
5. Create a Tracking Plan
Create a Tracking Plan that references your events and properties (~/tutorial-catalog/tracking-plan.yaml):
version:rudder/v0.1kind:tpmetadata:name:ecomm-tracking-planspec:id:ecomm-tracking-plandisplay_name:"Product Tracking Plan"description:"Tracking plan for product-related events"rules:- type:event_ruleid:product_viewed_ruleevent:$ref:"#/events/myevents/product_viewed"allow_unplanned:falseproperties:- $ref:"#/properties/myproperties/product_sku"required:true- $ref:"#/properties/myproperties/price"required:true- $ref:"#/properties/myproperties/user_profile"# Nested property of object typeproperties:- $ref:"#/properties/myproperties/user_profile/personal_info/first_name"- $ref:"#/properties/myproperties/user_profile/personal_info/last_name"
version:rudder/v0.1kind:tpmetadata:name:user-tracking-planspec:id:user-tracking-plandisplay_name:"User Tracking Plan"description:"Tracking plan for user identification and page view events"rules:- type:event_ruleid:user_identify_ruleevent:$ref:"#/events/myevents/user_identify"allow_unplanned:falseidentity_section:"traits"# Properties go in traits sectionproperties:- $ref:"#/properties/myproperties/email"required:true- $ref:"#/properties/myproperties/first_name"required:true- $ref:"#/properties/myproperties/last_name"required:false- type:event_ruleid:homepage_viewed_ruleevent:$ref:"#/events/myevents/homepage_viewed"allow_unplanned:trueidentity_section:"context.traits"# Properties go in context.traits sectionproperties:- $ref:"#/properties/myproperties/page_url"required:true- $ref:"#/properties/myproperties/referrer"required:false
You can also define Event Rule Variants in your Tracking Plan that define dynamic event validation rules that adapt based on context.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.