What formatting is needed to import an event schema?
Hi Ani A., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To import an event schema into Mixpanel's Lexicon, you need to follow a specific JSON format. Based on the knowledge sources, here's what you need to know: Event schemas in Mixpanel are defined using JSON Schema (specifically draft-07) and should include the following components: 1. Basic Structure: Each schema represents a single entity (usually an event) and includes:
- entityType
: Specifies whether it's an "event" or "profile"
- name
: The name of the event (e.g., "Added To Cart")
- schemaJson
: The actual schema definition2. Schema Definition: The schemaJson
object should include:
- $schema
: Reference to the JSON schema standard
- description
: A description of the event
- required
: Array of required properties
- properties
: Object containing property definitions
- metadata
: Object containing Mixpanel-specific metadataHere's an example of a properly formatted event schema: LBKS{ "entityType": "event", "name": "Added To Cart", "schemaJson": { "$schema": "[http://json-schema.org/draft-07/schema](http://json-schema.org/draft-07/schema)", "description": "Tracked when a user adds an item to their cart.", "required": [ "item_name", "item_id", "item_price" ], "additionalProperties": true, "metadata": { "com.mixpanel": { "tags": [ "Shopping", "KPIs" ], "displayName": "Item Purchased", "hidden": false, "dropped": false, "owners": [ { "name": "Pat Davis", "email": "pat.davis@​[mixpanel.com](http://mixpanel.com)" } ] } }, "properties": { "item_name": { "type": "string", "description": "The name of the item", "examples": [ "Blue Widget" ], "metadata": { "com.mixpanel": { "displayName": "Item Name" } } }, "item_id": { "type": "integer", "description": "The internal id of the item", "examples": [ 12345 ], "metadata": { "com.mixpanel": { "displayName": "Item ID" } } } } } }LBKS
When importing multiple schemas at once, you would wrap them in an "entries" array: LBKS{ "entries": [ { "entityType": "event", "name": "Event Name", "schemaJson": { ... } }, ... ], "truncate": false }LBKS
The truncate
parameter determines whether existing schemas not included in your import should be removed.For user profiles, you would use "entityType": "profile"
and "name": "$user"
.Lexicon Schemas API Overview provides more details on how schemas work in Mixpanel.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.