Skip to content

Commit

Permalink
Add dashboard_filter_required (#39159)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleggromov committed Feb 27, 2024
1 parent dc7f604 commit f7388f8
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 3 deletions.
12 changes: 11 additions & 1 deletion frontend/src/metabase/dashboard/actions/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ import type {
} from "metabase-types/api";
import type { Dispatch, GetState } from "metabase-types/store";

import { trackAutoApplyFiltersDisabled } from "../analytics";
import {
trackAutoApplyFiltersDisabled,
trackFilterRequired,
} from "../analytics";
import {
getAutoApplyFiltersToastId,
getDashboard,
Expand Down Expand Up @@ -298,6 +301,13 @@ export const setParameterRequired = createThunkAction(
required,
}));
}

if (required) {
const dashboardId = getDashboardId(getState());
if (dashboardId) {
trackFilterRequired(dashboardId);
}
}
},
);

Expand Down
9 changes: 8 additions & 1 deletion frontend/src/metabase/dashboard/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DashboardId, DashboardWidth } from "metabase-types/api";

import type { SectionId } from "./sections";

const DASHBOARD_SCHEMA_VERSION = "1-1-3";
const DASHBOARD_SCHEMA_VERSION = "1-1-4";

export const trackAutoApplyFiltersDisabled = (dashboardId: DashboardId) => {
trackSchemaEvent("dashboard", DASHBOARD_SCHEMA_VERSION, {
Expand Down Expand Up @@ -97,3 +97,10 @@ export const trackTabDuplicated = (dashboardId: DashboardId) => {
dashboard_id: dashboardId,
});
};

export const trackFilterRequired = (dashboardId: DashboardId) => {
trackSchemaEvent("dashboard", DASHBOARD_SCHEMA_VERSION, {
event: "dashboard_filter_required",
dashboard_id: dashboardId,
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Dashboard events",
"self": {
"vendor": "com.metabase",
"name": "dashboard",
"format": "jsonschema",
"version": "1-1-4"
},
"type": "object",
"properties": {
"event": {
"description": "Event name",
"type": "string",
"enum": [
"dashboard_created",
"dashboard_saved",
"question_added_to_dashboard",
"auto_apply_filters_disabled",
"dashboard_tab_created",
"dashboard_tab_deleted",
"dashboard_tab_duplicated",
"new_text_card_created",
"new_heading_card_created",
"new_link_card_created",
"new_action_card_created",
"card_set_to_hide_when_no_results",
"dashboard_pdf_exported",
"card_moved_to_tab",
"dashboard_card_duplicated",
"dashboard_card_replaced",
"dashboard_section_added",
"dashboard_width_toggled",
"dashboard_filter_required"
],
"maxLength": 1024
},
"dashboard_id": {
"description": "Unique identifier for a dashboard within the Metabase instance",
"type": "integer",
"minimum": 0,
"maximum": 2147483647
},
"question_id": {
"description": "Unique identifier for a question added to a dashboard",
"type": [
"integer",
"null"
],
"minimum": 0,
"maximum": 2147483647
},
"num_tabs": {
"description": "Number of tabs affected after the event",
"type": [
"integer",
"null"
],
"minimum": 0,
"maximum": 2147483647
},
"total_num_tabs": {
"description": "Total number of active tabs after the events",
"type": [
"integer",
"null"
],
"minimum": 0,
"maximum": 2147483647
},
"duration_milliseconds": {
"description": "Duration the action took to complete in milliseconds",
"type": [
"integer",
"null"
],
"minimum": 0,
"maximum": 2147483647
},
"section_layout": {
"description": "String describing the layout that was selected from the pre-built options",
"type": [
"string",
"null"
],
"maxLength": 1024
},
"full_width": {
"description": "Boolean set to True if the dashboard was toggled to full width and False if full width was disabled.",
"type": [
"boolean",
"null"
]
}
},
"required": [
"event",
"dashboard_id"
],
"additionalProperties": true
}
2 changes: 1 addition & 1 deletion src/metabase/analytics/snowplow.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
::browse_data "1-0-0"
::invite "1-0-1"
::csvupload "1-0-0"
::dashboard "1-1-3"
::dashboard "1-1-4"
::database "1-0-1"
::instance "1-1-2"
::metabot "1-0-1"
Expand Down

0 comments on commit f7388f8

Please sign in to comment.