Event Schema

Understanding event schema

What is event schema?

Event Schema is a structured representation of an event and its associated properties used in data analysis platforms. It defines the expected format, types, and constraints of event data to ensure consistency and accuracy. Think of it as a blueprint that outlines what kind of data you’re collecting and how it should look.

When you set up an Event Schema, you specify various elements like the event name, event properties, and data types. For example, an event called "User Signup" might include properties like "username" (string) and "signup_date" (date). This structure helps platforms like Statsig understand and process your data correctly.

Components of event schema

What are the key elements?

  • Event Name: The identifier for the event (e.g., 'User Signup').

  • Event Properties: Attributes associated with the event (e.g., 'username', 'signup_date').

  • Data Types: Specifies the type of data each property should hold (e.g., string, integer).

Handling unplanned data in event schema

What is considered unplanned data?

  • Unplanned event types: Events not initially included in the schema.

  • Unplanned properties: Event properties that were not defined in the schema.

  • Unplanned values: Property values that do not match the expected data type.

How to manage unplanned data?

Configure settings to handle unplanned events and properties. Decide if you want to mark, reject, or approve them. This step ensures you control unexpected data. For more information on event properties, refer to the Statsig Docs on Event Property.

Set up notifications for schema violations. Address these issues promptly to maintain data integrity. Quick responses prevent long-term data inconsistencies. Learn more about data mapping and how it can help manage unplanned data.

By managing unplanned data effectively, you keep your event schema accurate. This aids in reliable data analysis and insights. To explore more on logging events, check out Logging Events in Statsig.

Example scenarios of event schema

Example 1: User signup event

  • Event: 'User Signup'

  • Properties: 'username' (string), 'signup_date' (date), 'referral_code' (optional string)

  • Schema Definition: Ensures all signups capture the username and date, with an optional referral code.

To learn more about logging events, you can refer to the Statsig documentation which outlines how to log different types of events like user signups.

Example 2: Purchase event

  • Event: 'Purchase'

  • Properties: 'item_id' (integer), 'quantity' (integer), 'total_price' (float)

  • Schema Definition: Ensures all purchase events include essential details like item ID, quantity, and total price.

For detailed guidelines on event logging and best practices, visit Statsig's logging events guide. Additionally, you can explore the data sources used for experimental analysis and metrics creation. More specific examples of logging purchase events and other metrics can be found in the Statsig SDK reference guide.

Join the #1 experimentation community

Connect with like-minded product leaders, data scientists, and engineers to share the latest in product experimentation.

Try Statsig Today

Get started for free. Add your whole team!

What builders love about us

OpenAI OpenAI
Brex Brex
Notion Notion
SoundCloud SoundCloud
Ancestry Ancestry
At OpenAI, we want to iterate as fast as possible. Statsig enables us to grow, scale, and learn efficiently. Integrating experimentation with product analytics and feature flagging has been crucial for quickly understanding and addressing our users' top priorities.
OpenAI
Dave Cummings
Engineering Manager, ChatGPT
Brex's mission is to help businesses move fast. Statsig is now helping our engineers move fast. It has been a game changer to automate the manual lift typical to running experiments and has helped product teams ship the right features to their users quickly.
Brex
Karandeep Anand
President
At Notion, we're continuously learning what our users value and want every team to run experiments to learn more. It’s also critical to maintain speed as a habit. Statsig's experimentation platform enables both this speed and learning for us.
Notion
Mengying Li
Data Science Manager
We evaluated Optimizely, LaunchDarkly, Split, and Eppo, but ultimately selected Statsig due to its comprehensive end-to-end integration. We wanted a complete solution rather than a partial one, including everything from the stats engine to data ingestion.
SoundCloud
Don Browning
SVP, Data & Platform Engineering
We only had so many analysts. Statsig provided the necessary tools to remove the bottleneck. I know that we are able to impact our key business metrics in a positive way with Statsig. We are definitely heading in the right direction with Statsig.
Ancestry
Partha Sarathi
Director of Engineering
We use cookies to ensure you get the best experience on our website.
Privacy Policy