Skip to content

Commit

Permalink
change: [M3-5963] - Update Marketplace analytics search event (#9141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjac0bs authored May 23, 2023
1 parent 8c08af3 commit 776c5bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class FromAppsContent extends React.Component<CombinedProps, State> {
const didUserSelectCategory = categoryItem !== null;
let instancesInCategory: StackScript[] | undefined = [];
if (didUserSelectCategory) {
sendMarketplaceSearchEvent(categoryItem.label);
sendMarketplaceSearchEvent('Category Dropdown', categoryItem.label);
const appsInCategory = oneClickApps.filter((oca) =>
oca.categories?.includes(categoryItem.value)
);
Expand Down Expand Up @@ -296,6 +296,10 @@ class FromAppsContent extends React.Component<CombinedProps, State> {
this.props.updateStackScript
);

const handleSearchFieldClick = () => {
sendMarketplaceSearchEvent('Search Field');
};

const logoUrl = appInstances?.find(
(app) => app.id === selectedStackScriptID
)?.logo_url;
Expand Down Expand Up @@ -324,6 +328,7 @@ class FromAppsContent extends React.Component<CombinedProps, State> {
fullWidth
onSearch={this.onSearch}
label="Search marketplace"
onClick={handleSearchFieldClick}
hideLabel
value={query}
/>
Expand Down
11 changes: 8 additions & 3 deletions packages/manager/src/utilities/ga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,15 @@ export const sendObjectStorageDocsEvent = (action: string) => {
});
};

export const sendMarketplaceSearchEvent = (appCategory?: string) => {
type TypeOfSearch = 'Search Field' | 'Category Dropdown';

export const sendMarketplaceSearchEvent = (
typeOfSearch: TypeOfSearch,
appCategory?: string
) => {
sendEvent({
category: 'Marketplace Create Flow',
action: 'Category Dropdown',
label: appCategory,
action: `Click: ${typeOfSearch}`,
label: appCategory ?? 'Apps Search',
});
};

0 comments on commit 776c5bd

Please sign in to comment.