diff --git a/.changeset/breezy-kids-obey.md b/.changeset/breezy-kids-obey.md new file mode 100644 index 0000000000..db3fa796e9 --- /dev/null +++ b/.changeset/breezy-kids-obey.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-import': minor +--- + +Added analytics event for import entity button diff --git a/plugins/catalog-import/src/components/StepReviewLocation/StepReviewLocation.tsx b/plugins/catalog-import/src/components/StepReviewLocation/StepReviewLocation.tsx index 7943b6e3b8..74ebd973d0 100644 --- a/plugins/catalog-import/src/components/StepReviewLocation/StepReviewLocation.tsx +++ b/plugins/catalog-import/src/components/StepReviewLocation/StepReviewLocation.tsx @@ -22,7 +22,7 @@ import { BackButton, NextButton } from '../Buttons'; import { EntityListComponent } from '../EntityListComponent'; import { PrepareResult, ReviewResult } from '../useImportState'; -import { configApiRef, useApi } from '@backstage/core-plugin-api'; +import { configApiRef, useAnalytics, useApi } from '@backstage/core-plugin-api'; import { Link } from '@backstage/core-components'; import { stringifyEntityRef } from '@backstage/catalog-model'; import { assertError } from '@backstage/errors'; @@ -40,6 +40,7 @@ export const StepReviewLocation = ({ }: Props) => { const catalogApi = useApi(catalogApiRef); const configApi = useApi(configApiRef); + const analytics = useAnalytics(); const appTitle = configApi.getOptional('app.title') || 'Backstage'; @@ -52,6 +53,7 @@ export const StepReviewLocation = ({ : false; const handleClick = useCallback(async () => { setSubmitted(true); + analytics.captureEvent('click', 'import entity'); try { let refreshed = new Array<{ target: string }>(); if (prepareResult.type === 'locations') { @@ -108,7 +110,7 @@ export const StepReviewLocation = ({ setSubmitted(false); } } - }, [prepareResult, onReview, catalogApi]); + }, [prepareResult, onReview, catalogApi, analytics]); return ( <>