Skip to content

Commit

Permalink
rename event -> simple_event and trackEvent -> trackSimpleEvent (#47608)
Browse files Browse the repository at this point in the history
* rename event -> simple_event and trackEvent -> trackSimpleEvent

* add empty line at the end of the file

Co-authored-by: Thomas Schmidt <thomas@metabase.com>

---------

Co-authored-by: Thomas Schmidt <thomas@metabase.com>
  • Loading branch information
2 people authored and Metabase bot committed Sep 4, 2024
1 parent d40b028 commit f3b6360
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion frontend/src/metabase-types/analytics/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type SchemaEventMap = {
embed_flow: EmbedFlowEvent;
embed_share: EmbedShareEvent;
embedding_homepage: EmbeddingHomepageEvent;
event: SimpleEvent;
simple_event: SimpleEvent;
invite: InviteEvent;
metabot: MetabotEvent;
model: ModelEvent;
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/metabase/lib/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const VERSIONS: Record<SchemaType, string> = {
embed_flow: "1-0-1",
embed_share: "1-0-0",
embedding_homepage: "1-0-0",
event: "1-0-0",
simple_event: "1-0-0",
invite: "1-0-1",
metabot: "1-0-1",
model: "1-0-0",
Expand All @@ -34,8 +34,8 @@ const VERSIONS: Record<SchemaType, string> = {
upsell: "1-0-0",
};

export function trackEvent(event: SimpleEvent) {
trackSchemaEvent("event", event);
export function trackSimpleEvent(event: SimpleEvent) {
trackSchemaEvent("simple_event", event);
}

export function trackSchemaEvent(schema: SchemaType, event: SchemaEvent): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { trackEvent } from "metabase/lib/analytics";
import { trackSimpleEvent } from "metabase/lib/analytics";

export const trackButtonClicked = () => {
trackEvent({
trackSimpleEvent({
event: "csv_upload_clicked",
triggered_from: "left_nav",
});
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Generic event to track interactions and actions that happen within Metabase. This should be used as a default schema for tracking events. If more specific context is needed, we can use custom context entities (https://docs.snowplow.io/docs/understanding-your-pipeline/entities/).",
"self": {
"vendor": "com.metabase",
"name": "simple_event",
"format": "jsonschema",
"version": "1-0-0"
},
"type": "object",
"properties": {
"event": {
"description": "Name of the action. Noun (target) + Verb in the past (action) which define the action taken - e.g. question_created, dashboard_updated, dashboard_auto_apply_filter_enabled",
"type": "string",
"maxLength": 1024
},
"target_id": {
"description": "(Optional) ID of the entity that the action was performed on. E.g. the ID of the question that was created in a question_created event.",
"type": [
"integer",
"null"
],
"minimum": 0,
"maximum": 2147483647
},
"triggered_from": {
"description": "(Optional) From where the action was taken/triggered. This can be generic like 'dashboard' or also more specific like 'dashboard_top_nav'.",
"type": [
"string",
"null"
],
"maxLength": 1024
},
"duration_ms": {
"description": "(Optional) Duration in milliseconds",
"type": [
"integer",
"null"
],
"minimum": 0,
"maximum": 2147483647
},
"result": {
"description": "(Optional) The outcome of the action (e.g. success, failure, …)",
"type": [
"string",
"null"
],
"maxLength": 1024
},
"event_detail": {
"description": "(Optional) String that can be used for additional details that describe the event, e.g. the type of question that was created in a question_created event. We should NOT pass JSON here.",
"type": [
"string",
"null"
],
"maxLength": 1024
}
},
"required": [
"event"
],
"additionalProperties": true
}

0 comments on commit f3b6360

Please sign in to comment.