Wizard: Update Amplitude tracking
This updates snippets used for event tracking in Amplitude, adding `imageBuilder` to the name of the event and as a `module` property. Two more typed events were also added to track number of created blueprints. Name for both events is the same `blueprintCreated`, the differentiation between Create and Create and build images is captured in the `type` property. These new events will allow to calculate percentage of users that were shown recommendations and of those who added a recommended package while succesfully finishing blueprint creation.
This commit is contained in:
parent
568c85066d
commit
be8a00d186
3 changed files with 40 additions and 12 deletions
|
|
@ -10,7 +10,9 @@ import {
|
|||
Modal,
|
||||
Button,
|
||||
} from '@patternfly/react-core';
|
||||
import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
|
||||
|
||||
import { AMPLITUDE_MODULE_NAME } from '../../../../../constants';
|
||||
import { setBlueprintId } from '../../../../../store/BlueprintSlice';
|
||||
import { useAppDispatch } from '../../../../../store/hooks';
|
||||
import {
|
||||
|
|
@ -30,6 +32,8 @@ export const CreateSaveAndBuildBtn = ({
|
|||
setIsOpen,
|
||||
isDisabled,
|
||||
}: CreateDropdownProps) => {
|
||||
const { analytics } = useChrome();
|
||||
|
||||
const [buildBlueprint] = useComposeBlueprintMutation();
|
||||
const [createBlueprint] = useCreateBlueprintMutation({
|
||||
fixedCacheKey: 'createBlueprintKey',
|
||||
|
|
@ -38,6 +42,12 @@ export const CreateSaveAndBuildBtn = ({
|
|||
const onSaveAndBuild = async () => {
|
||||
const requestBody = await getBlueprintPayload();
|
||||
setIsOpen(false);
|
||||
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME}-blueprintCreated`, {
|
||||
module: AMPLITUDE_MODULE_NAME,
|
||||
type: 'createBlueprintAndBuildImages',
|
||||
});
|
||||
|
||||
const blueprint =
|
||||
requestBody &&
|
||||
(await createBlueprint({
|
||||
|
|
@ -68,6 +78,8 @@ export const CreateSaveButton = ({
|
|||
getBlueprintPayload,
|
||||
isDisabled,
|
||||
}: CreateDropdownProps) => {
|
||||
const { analytics } = useChrome();
|
||||
|
||||
const [createBlueprint, { isLoading }] = useCreateBlueprintMutation({
|
||||
fixedCacheKey: 'createBlueprintKey',
|
||||
});
|
||||
|
|
@ -120,11 +132,17 @@ export const CreateSaveButton = ({
|
|||
|
||||
setIsOpen(false);
|
||||
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME}-blueprintCreated`, {
|
||||
module: AMPLITUDE_MODULE_NAME,
|
||||
type: 'createBlueprint',
|
||||
});
|
||||
|
||||
const blueprint =
|
||||
requestBody &&
|
||||
(await createBlueprint({
|
||||
createBlueprintRequest: requestBody,
|
||||
}).unwrap());
|
||||
|
||||
if (blueprint) {
|
||||
dispatch(setBlueprintId(blueprint?.id));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue