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