Define and manage events in your Data Catalog project using YAML configuration files.
Available Plans
free
starter
growth
enterprise
4 minute read
Events are the foundation of your tracking implementation in RudderStack. This guide shows you how to define and manage events in your Data Catalog using YAML configuration files.
Event types
You can define the following event types in your Data Catalog project using Rudder CLI:
Event type
Description
Track
Record user actions and behaviors
Identify
Capture user identification and associated traits
Page
Track web page views
Screen
Monitor mobile app screen views
Group
Associate users with organizations
Define events
Using your preferred text editor, create a YAML file in your Data Catalog project and add the below content:
Basic structure
You can define events in YAML files with the kind: events specification. See Data Catalog YAML Reference for the detailed YAML spec containing event definitions.
version:rudder/0.1kind:eventsmetadata:name:myeventgroupspec:events:- id:product_viewedname:"Product Viewed"// Only applicable for track eventsevent_type:trackdescription:"Triggered when a user views a product"
Each event definition requires:
A unique identifier (id)
The event type (event_type)
A descriptive name (name) (applicable only for track events)
Optional description (description)
Do not include the name parameter for identify, page, or group events as they will not pass validation and result in an error.
The following snippets highlight the YAML definitions for different event types:
- id:user_identifyevent_type:identifydescription:"Captures user profile information"
spec:events:- id:checkout_completedname:"Checkout Completed"event_type:trackdescription:"Triggered when a user completes the checkout process"
- id:org_associationevent_type:groupdescription:"Associates users with their organization"
Event groups
You can group related events in a single YAML file based on business context (like ecommerce or user management) or other logical categories. Define each group with a unique metadata.name and list related events under spec.events.
When defining event groups, ensure that:
Events in the same group share similar validation requirements.
Related events that are often used together in tracking plans are grouped together.
Each event group has a clear, specific purpose (for example, ecommerce_events for ecommerce-related tracking).
The following examples show how to organize events into meaningful groups, along with their YAML definitions:
version:rudder/0.1kind:eventsmetadata:name:ecommerce_eventsspec:events:- id:product_viewedname:"Product Viewed"event_type:trackdescription:"Triggered when a user views a product"- id:add_to_cartname:"Add to Cart"event_type:trackdescription:"Triggered when a user adds a product to cart"- id:checkout_startedname:"Checkout Started"event_type:trackdescription:"Triggered when a user starts checkout"
version:rudder/0.1kind:eventsmetadata:name:user_eventsspec:events:- id:user_registeredname:"User Registered"event_type:trackdescription:"Triggered when a new user registers"- id:user_loginname:"User Login"event_type:trackdescription:"Triggered when a user logs in"- id:profile_updatedname:"Profile Updated"event_type:trackdescription:"Triggered when a user updates their profile"
Best practices
Follow these best practices when defining events and event groups:
Naming conventions
Use clear, descriptive names
Follow consistent capitalization
Avoid special characters
Organization
Use event groups to group related events together
Use meaningful names that reflect the group’s purpose
Validation
Use unique identifiers
Validate event definitions
Test before deployment
Validate and deploy events
Before deploying your events to the workspace, validate them to ensure they follow the correct structure and meet your requirements.
Validate events
Run the following command to validate your event definitions:
rudder-cli tp validate -l ~/tutorial-catalog
The command checks your event definitions for:
Required fields and correct structure
Valid event types and property references
Unique identifiers across your catalog
Proper YAML syntax
If validation succeeds, the command returns no output. If it finds any issues, it displays specific error messages to help you fix them.
Deploy events
After validating your events, deploy them to your RudderStack workspace:
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.