Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: [M3-5963] - Update Marketplace analytics search event #9141

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
});
};