From 219b480535b842cf2120e2aedba6e61f082d0695 Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Fri, 5 Sep 2025 18:04:20 -0400 Subject: [PATCH 1/6] add cohorts sections to Lexicon --- pages/docs/data-governance/lexicon.mdx | 13 +++++++++---- pages/docs/users/cohorts.mdx | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pages/docs/data-governance/lexicon.mdx b/pages/docs/data-governance/lexicon.mdx index 82a5c00160..39dbc62fd4 100644 --- a/pages/docs/data-governance/lexicon.mdx +++ b/pages/docs/data-governance/lexicon.mdx @@ -20,10 +20,11 @@ Tracked Data 3. Profile Properties Computed Data -1. Custom Events -2. Lookup Tables -3. Formulas -4. Behaviors +1. Cohorts +2. Custom Events +3. Lookup Tables +4. Formulas +5. Behaviors ### Events @@ -86,6 +87,10 @@ If you have Group Analytics enabled, you will see a dropdown on the Profile Prop ![Lexicon Profile Properties](/lexicon-group-analytics-GIF.gif) +### Cohorts + +[Cohorts](/docs/users/cohorts) are groups of users that share a certain set of properties or who perform a similar sequence of events. You can create cohorts based on user properties, events, and other criteria to analyze user behavior and engagement. + ### Custom Events [Custom Events](/docs/features/custom-events) are events and properties you combine into one event to use in Mixpanel reports. The fields for custom events are “Name”, “Description”, "Definition", "30 Day Queries", "Last Queried" and “Created” (defined above). diff --git a/pages/docs/users/cohorts.mdx b/pages/docs/users/cohorts.mdx index 62e9fdc63e..b49d742249 100644 --- a/pages/docs/users/cohorts.mdx +++ b/pages/docs/users/cohorts.mdx @@ -43,6 +43,9 @@ For example, suppose the cohort’s filter criteria is: users where user[“City Mixpanel computes the above over the last 30 days and then groups the set of users who have property user[“City”] == “SF” as of right now and intersect that with the daily cohort of users who did Order Ride 3 times in the last 7 days. +### Creating a Cohort via Lexicon +Cohorts can also be created and managed in [Lexicon](/docs/data-governance/lexicon). In Lexicon, you can see all your saved cohorts alongside your other saved definitions like metrics, custom events, and custom properties. + ### Creating a Cohort with Changing User Properties With historical user or group properties, you can optionally Add Time and Measurement to specify the time-range over which to search for the property value From b23176b2674397f7303e607d4ea81e58fc8358ba Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Thu, 2 Oct 2025 13:29:00 -0400 Subject: [PATCH 2/6] update upload schemas --- openapi/src/lexicon-schemas.openapi.yaml | 31 ++--- .../upload-schema-by-entity-and-name.md | 120 +++++++++++++++++- 2 files changed, 135 insertions(+), 16 deletions(-) diff --git a/openapi/src/lexicon-schemas.openapi.yaml b/openapi/src/lexicon-schemas.openapi.yaml index 24eb1909f7..1c158c354f 100644 --- a/openapi/src/lexicon-schemas.openapi.yaml +++ b/openapi/src/lexicon-schemas.openapi.yaml @@ -221,12 +221,12 @@ paths: "displayName": "Item Purchased", "hidden": false, "dropped": false, - "owners": [ - { - "name": "First Last", - "email": "first.last@mixpanel.com" - } - ] + "contacts": [ + "first.last@mixpanel.com" + ], + "teamContacts": [ + "Analytics Team" + ], } }, "properties": { @@ -410,20 +410,21 @@ components: [Events only] If true, the event will be dropped at ingestion time. default: false - owners: + contacts: type: array description: >- - A list of people or teams that are responsible for this + A list of emails belonging to users responsible for this entity. items: - type: object - properties: - name: - type: string - email: - type: string - format: email + type: string additionalProperties: false + teamContacts: + type: array + description: >- + A list of team names responsible for this + entity. + items: + type: string additionalProperties: false SchemaEntry: type: object diff --git a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md index ffe055d388..c4302a0304 100644 --- a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md +++ b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md @@ -1,8 +1,126 @@ --- title: "Create/Replace One" slug: "upload-schema-by-entity-and-name" -excerpt: "Upload a schema for a single entity. If a schema already exists for a specified entity, it will be replaced by the one you upload.\n[block:callout] {\n \"type\": \"warning\",\n \"title\": \"Metadata merging behavior\",\n \"body\": \"If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{\\\"metadata\\\": {\\\"com.mixpanel\\\": {\\\"hidden\\\": true}}}` and you upload a new schema without \\\"hidden\\\", we will merge `\\\"hidden\\\": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`.\"\n} [/block]\n[block:callout] {\n \"type\": \"info\",\n \"title\": \"Adding a schema for User Profiles\",\n \"body\": \"To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`.\"\n} [/block]\n### Example POST Body\n```json\n{\n \"$schema\": \"http://json-schema.org/draft-07/schema\",\n \"description\": \"Tracked when a user adds an item to their cart.\",\n \"required\": [\n \"item_name\",\n \"item_id\",\n \"item_price\"\n ],\n \"additionalProperties\": true,\n \"metadata\": {\n \"com.mixpanel\": {\n \"tags\": [\n \"Shopping\",\n \"KPIs\"\n ],\n \"displayName\": \"Item Purchased\",\n \"hidden\": false,\n \"dropped\": false,\n \"owners\": [\n {\n \"name\": \"Pat Davis\",\n \"email\": \"pat.david@mixpanel.com\"\n }\n ]\n }\n },\n \"properties\": {\n \"item_name\": {\n \"type\": \"string\",\n \"description\": \"The name of the item\",\n \"examples\": [\n \"Blue Widget\"\n ],\n \"metadata\": {\n \"com.mixpanel\": {\n \"displayName\": \"Item Name\"\n }\n }\n },\n \"item_id\": {\n \"type\": \"integer\",\n \"description\": \"The internal id of the item\",\n \"examples\": [\n 12345\n ],\n \"metadata\": {\n \"com.mixpanel\": {\n \"displayName\": \"Item ID\"\n }\n }\n },\n \"item_price\": {\n \"type\": \"number\",\n \"description\": \"The current price of the item\",\n \"examples\": [\n 25.35\n ],\n \"metadata\": {\n \"com.mixpanel\": {\n \"displayName\": \"Price\"\n }\n }\n },\n \"promo_id\": {\n \"type\": \"integer\",\n \"description\": \"The id of any promo in progress for this item\",\n \"examples\": [\n 82523,\n 18382\n ],\n \"metadata\": {\n \"com.mixpanel\": {\n \"displayName\": \"Promo ID\"\n }\n }\n },\n \"date_added_to_catalog\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"description\": \"The date this item was added to the store catalog\",\n \"examples\": [\n \"2015-03-05T15:25:23\"\n ],\n \"metadata\": {\n \"com.mixpanel\": {\n \"displayName\": \"Date Added\"\n }\n }\n }\n }\n} ```" +excerpt: "" hidden: false createdAt: "2020-11-20T21:23:20.204Z" updatedAt: "2023-09-26T21:06:39.074Z" --- + +Upload a schema for a single entity. If a schema already exists for a specified entity, it will be replaced by the one you upload. + +[block:callout] { + "type": "warning", + "title": "Metadata merging behavior", + "body": "If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{\"metadata\": {\"com.mixpanel\": {\"hidden\": true}}}` and you upload a new schema without \"hidden\", we will merge `\"hidden\": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`." +} [/block] + +[block:callout] { + "type": "info", + "title": "Adding a schema for User Profiles", + "body": "To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`." +} [/block] + +### Example POST Body +```json +{ + "entries": [ + { + "entityType": "event", + "name": "Added To Cart", + "schemaJson": { + "$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" + } + ] + } + }, + "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" + } + } + }, + "item_price": { + "type": "number", + "description": "The current price of the item", + "examples": [ + 25.35 + ], + "metadata": { + "com.mixpanel": { + "displayName": "Price" + } + } + }, + "promo_id": { + "type": "integer", + "description": "The id of any promo in progress for this item", + "examples": [ + 82523, + 18382 + ], + "metadata": { + "com.mixpanel": { + "displayName": "Promo ID" + } + } + }, + "date_added_to_catalog": { + "type": "string", + "format": "date-time", + "description": "The date this item was added to the store catalog", + "examples": [ + "2015-03-05T15:25:23" + ], + "metadata": { + "com.mixpanel": { + "displayName": "Date Added" + } + } + } + } + } + } + ], + "truncate": false +} +``` From f20141f422d63e501c42c939f0b3df07d1a323b1 Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Thu, 2 Oct 2025 15:58:22 -0400 Subject: [PATCH 3/6] update reference --- .../upload-schema-by-entity-and-name.md | 209 +++++++++--------- 1 file changed, 103 insertions(+), 106 deletions(-) diff --git a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md index 37426f0d19..ee6e542729 100644 --- a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md +++ b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md @@ -3,118 +3,115 @@ title: Create/Replace One category: uri: Lexicon Schemas API content: - excerpt: >- - Upload a schema for a single entity. If a schema already exists for a - specified entity, it will be replaced by the one you upload. + excerpt: '' +privacy: + view: public +--- +Upload a schema for a single entity. If a schema already exists for a specified entity, it will be replaced by the one you upload. - [block:callout] { - "type": "warning", - "title": "Metadata merging behavior", - "body": "If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{\"metadata\": {\"com.mixpanel\": {\"hidden\": true}}}` and you upload a new schema without \"hidden\", we will merge `\"hidden\": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`." - } [/block] + + Metadata merging behavior - [block:callout] { - "type": "info", - "title": "Adding a schema for User Profiles", - "body": "To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`." - } [/block] + If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{"metadata": {"com.mixpanel": {"hidden": true}}}` and you upload a new schema without "hidden", we will merge `"hidden": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`. + - ### Example POST Body + + Adding a schema for User Profiles - ```json + To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`. + - { - "$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": "First Last", - "email": "first.last@mixpanel.com" - } - ] +### Example POST Body + +```json +{ + "$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": "First Last", + "email": "first.last@mixpanel.com" + } + ] + } + }, + "properties": { + "item_name": { + "type": "string", + "description": "The name of the item", + "examples": [ + "Blue Widget" + ], + "metadata": { + "com.mixpanel": { + "displayName": "Item Name" + } } }, - "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" - } - } - }, - "item_price": { - "type": "number", - "description": "The current price of the item", - "examples": [ - 25.35 - ], - "metadata": { - "com.mixpanel": { - "displayName": "Price" - } - } - }, - "promo_id": { - "type": "integer", - "description": "The id of any promo in progress for this item", - "examples": [ - 82523, - 18382 - ], - "metadata": { - "com.mixpanel": { - "displayName": "Promo ID" - } - } - }, - "date_added_to_catalog": { - "type": "string", - "format": "date-time", - "description": "The date this item was added to the store catalog", - "examples": [ - "2015-03-05T15:25:23" - ], - "metadata": { - "com.mixpanel": { - "displayName": "Date Added" - } - } + "item_id": { + "type": "integer", + "description": "The internal id of the item", + "examples": [ + 12345 + ], + "metadata": { + "com.mixpanel": { + "displayName": "Item ID" + } + } + }, + "item_price": { + "type": "number", + "description": "The current price of the item", + "examples": [ + 25.35 + ], + "metadata": { + "com.mixpanel": { + "displayName": "Price" + } + } + }, + "promo_id": { + "type": "integer", + "description": "The id of any promo in progress for this item", + "examples": [ + 82523, + 18382 + ], + "metadata": { + "com.mixpanel": { + "displayName": "Promo ID" + } + } + }, + "date_added_to_catalog": { + "type": "string", + "format": "date-time", + "description": "The date this item was added to the store catalog", + "examples": [ + "2015-03-05T15:25:23" + ], + "metadata": { + "com.mixpanel": { + "displayName": "Date Added" + } } } - } ``` -privacy: - view: public ---- - + } +} ``` From 433c08650de9e04a0100fa9116445c4ab1aa739e Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Thu, 2 Oct 2025 16:07:13 -0400 Subject: [PATCH 4/6] update yaml --- openapi/src/lexicon-schemas.openapi.yaml | 112 +---------------------- 1 file changed, 1 insertion(+), 111 deletions(-) diff --git a/openapi/src/lexicon-schemas.openapi.yaml b/openapi/src/lexicon-schemas.openapi.yaml index 1c158c354f..ccb03291c2 100644 --- a/openapi/src/lexicon-schemas.openapi.yaml +++ b/openapi/src/lexicon-schemas.openapi.yaml @@ -183,117 +183,7 @@ paths: summary: Create/Replace One tags: - Create Schemas - description: >- - Upload a schema for a single entity. If a schema already exists for a - specified entity, it will be replaced by the one you upload. - - [block:callout] { - "type": "warning", - "title": "Metadata merging behavior", - "body": "If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{\"metadata\": {\"com.mixpanel\": {\"hidden\": true}}}` and you upload a new schema without \"hidden\", we will merge `\"hidden\": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`." - } [/block] - - [block:callout] { - "type": "info", - "title": "Adding a schema for User Profiles", - "body": "To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`." - } [/block] - - ### Example POST Body - - ```json - - { - "$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, - "contacts": [ - "first.last@mixpanel.com" - ], - "teamContacts": [ - "Analytics Team" - ], - } - }, - "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" - } - } - }, - "item_price": { - "type": "number", - "description": "The current price of the item", - "examples": [ - 25.35 - ], - "metadata": { - "com.mixpanel": { - "displayName": "Price" - } - } - }, - "promo_id": { - "type": "integer", - "description": "The id of any promo in progress for this item", - "examples": [ - 82523, - 18382 - ], - "metadata": { - "com.mixpanel": { - "displayName": "Promo ID" - } - } - }, - "date_added_to_catalog": { - "type": "string", - "format": "date-time", - "description": "The date this item was added to the store catalog", - "examples": [ - "2015-03-05T15:25:23" - ], - "metadata": { - "com.mixpanel": { - "displayName": "Date Added" - } - } - } - } - } ``` + description: "" requestBody: content: application/json: From 04529cef616ab3ca3b213a2011bc5c94ca1540b1 Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Thu, 2 Oct 2025 16:17:46 -0400 Subject: [PATCH 5/6] update json example --- .../create-schemas/upload-schema-by-entity-and-name.md | 10 +++++----- .../create-schemas/upload-schemas-for-project.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md index ee6e542729..b91b91d480 100644 --- a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md +++ b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md @@ -42,11 +42,11 @@ Upload a schema for a single entity. If a schema already exists for a specified "displayName": "Item Purchased", "hidden": false, "dropped": false, - "owners": [ - { - "name": "First Last", - "email": "first.last@mixpanel.com" - } + "contacts": [ + "first.last@mixpanel.com" + ], + "teamContacts": [ + "Analytics Team" ] } }, diff --git a/reference/Lexicon Schemas API/create-schemas/upload-schemas-for-project.md b/reference/Lexicon Schemas API/create-schemas/upload-schemas-for-project.md index 1287cd72c9..4969bc37d8 100644 --- a/reference/Lexicon Schemas API/create-schemas/upload-schemas-for-project.md +++ b/reference/Lexicon Schemas API/create-schemas/upload-schemas-for-project.md @@ -47,11 +47,11 @@ Upload schemas in bulk to the specified project. If a schema already exists for "displayName": "Item Purchased", "hidden": false, "dropped": false, - "owners": [ - { - "name": "First Last", - "email": "first.last@mixpanel.com" - } + "contacts": [ + "first.last@mixpanel.com" + ], + "teamContacts": [ + "Analytics Team" ] } }, From b8b67635a4a59eabf88903b9817c4aab467b1d64 Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Thu, 2 Oct 2025 16:19:01 -0400 Subject: [PATCH 6/6] fix --- .../create-schemas/upload-schema-by-entity-and-name.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md index b91b91d480..5412e0dc2b 100644 --- a/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md +++ b/reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md @@ -114,4 +114,5 @@ Upload a schema for a single entity. If a schema already exists for a specified } } } -} ``` +} +```