diff --git a/packages/slice-machine/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx b/packages/slice-machine/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx index da26e43c5..4aa05d08a 100644 --- a/packages/slice-machine/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx +++ b/packages/slice-machine/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx @@ -139,7 +139,7 @@ const TabZone: FC = ({ tabId }) => { toast.success(`${field.type === "Group" ? "Group" : "Field"} added`); }); - trackFieldAdded(id, newField); + trackFieldAdded({ id, field: newField }); }; const onDragEnd = (result: DropResult) => { diff --git a/packages/slice-machine/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx b/packages/slice-machine/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx index 8dbdd1d33..354249d3c 100644 --- a/packages/slice-machine/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx +++ b/packages/slice-machine/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx @@ -157,7 +157,7 @@ const FieldZones: FC = () => { toast.success(`${widgetTypeName === "Group" ? "Group" : "Field"} added`); }); - trackFieldAdded(id, newField); + trackFieldAdded({ id, field: newField }); }; const _onCreateOrSave = (widgetArea: WidgetsArea) => { diff --git a/packages/slice-machine/src/legacy/lib/models/common/widgets/Group/ListItem/index.jsx b/packages/slice-machine/src/legacy/lib/models/common/widgets/Group/ListItem/index.jsx index 34951ee8d..164a534b7 100644 --- a/packages/slice-machine/src/legacy/lib/models/common/widgets/Group/ListItem/index.jsx +++ b/packages/slice-machine/src/legacy/lib/models/common/widgets/Group/ListItem/index.jsx @@ -70,7 +70,7 @@ export const CustomListItem = ({ isNewGroupField: true, }); - trackFieldAdded(id, newField); + trackFieldAdded({ id, field: newField }); }; const onSaveField = ({ apiId: previousKey, newKey, value }) => { diff --git a/packages/slice-machine/src/utils/tracking/trackFieldAdded.ts b/packages/slice-machine/src/utils/tracking/trackFieldAdded.ts index 5367e285f..e1ecf6cb8 100644 --- a/packages/slice-machine/src/utils/tracking/trackFieldAdded.ts +++ b/packages/slice-machine/src/utils/tracking/trackFieldAdded.ts @@ -9,10 +9,14 @@ import { SlicePrimaryFieldSM } from "@/legacy/lib/models/common/Slice"; import { getContentTypeForTracking } from "./getContentTypeForTracking"; -export function trackFieldAdded( - id: string, - field: SlicePrimaryFieldSM | NestableWidget | UID | Group, -) { +type TrackFieldAddedParam = { + id: string; + field: SlicePrimaryFieldSM | NestableWidget | UID | Group; +}; + +export function trackFieldAdded(params: TrackFieldAddedParam) { + const { id, field } = params; + void telemetry.track({ event: "field:added", id,