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

Log click events on search homepage and repogroup page #12405

Merged
merged 3 commits into from Jul 24, 2020
Merged

Conversation

attfarhan
Copy link
Contributor

Fixes #12356.

Adds 3 event to our logging:

  • RepogroupPageRepoLinkClicked event when clicking on repository links on the repogroup page
  • ExampleSearchClicked when an example search is clicked on the homepage
  • ExampleLanguageSearchClicked when an example language is clicked on the homepage

@ebrodymoore do these names suffice or should they be follow a certain format?

@attfarhan attfarhan requested review from ebrodymoore, poojaj-tech and a team July 22, 2020 16:54
@@ -182,11 +182,13 @@ export const RepogroupPage: React.FunctionComponent<RepogroupPageProps> = (props
)
}

const RepoLinkClicked = (): void => eventLogger.log('RepogroupPageRepoLinkClicked')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we want to pass in any data with the event? Such as repo name in this case? I'm not sure if we are able to do that but it seems that slicing these events based on associated data can be useful

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can pass along data about the specific click that'd be ideal!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebrodymoore pass through the actual language/example that was clicked?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah exactly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, would be great if we could pass through the link clicked on:
RepogroupPageRepoLinkClicked -> Repo name or search url
ExampleSearchClicked -> search url
ExampleLanguageSearchClicked -> Language or search url

@ebrodymoore
Copy link
Contributor

@attfarhan the naming convention is good!

@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #12405 into master will decrease coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #12405      +/-   ##
==========================================
- Coverage   50.62%   50.55%   -0.07%     
==========================================
  Files        1415     1414       -1     
  Lines       79235    79133     -102     
  Branches     6539     6539              
==========================================
- Hits        40111    40004     -107     
- Misses      35666    35674       +8     
+ Partials     3458     3455       -3     
Flag Coverage Δ
#go 51.93% <ø> (-0.10%) ⬇️
#integration 24.26% <100.00%> (+0.01%) ⬆️
#storybook 12.64% <100.00%> (+<0.01%) ⬆️
#typescript 46.86% <100.00%> (+<0.01%) ⬆️
#unit 47.16% <0.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
web/src/repogroups/RepogroupPage.tsx 76.92% <100.00%> (+0.92%) ⬆️
web/src/search/input/SearchPage.tsx 70.58% <100.00%> (+3.92%) ⬆️
enterprise/internal/codeintel/store/store.go 66.66% <0.00%> (-10.26%) ⬇️
...terprise/internal/codeintel/store/observability.go 89.28% <0.00%> (-6.46%) ⬇️
.../internal/codeintel/resolvers/graphql/locations.go 85.45% <0.00%> (-1.82%) ⬇️
enterprise/internal/codeintel/store/lock.go
internal/db/basestore/rows.go 4.54% <0.00%> (+1.46%) ⬆️

@@ -61,8 +61,9 @@ interface Props
showCampaigns: boolean
}

const SearchExampleClicked = (): void => eventLogger.log('ExampleSearchClicked')
const LanguageExampleClicked = (): void => eventLogger.log('ExampleLanguageSearchClicked')
const SearchExampleClicked = (url: string) => (): void => eventLogger.log('ExampleSearchClicked', { url })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the the url itself might not as human readable and stable, maybe give them human readable name?

SearchExampleClicked("js_alert_calls")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to avoid this for now, since examples can change down the line, and a naming convention for each could be imprecise. We pass URLs for other events so it's not an uncommon thing to see in our codebase. @ebrodymoore any objections here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections from me. Thanks @attfarhan

Copy link
Contributor

@twop twop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. Left a minor comment on reporting urls directly in events

@attfarhan attfarhan merged commit 3dd163b into master Jul 24, 2020
@attfarhan attfarhan deleted the fa/logging branch July 24, 2020 09:54
@@ -185,11 +185,14 @@ export const RepogroupPage: React.FunctionComponent<RepogroupPageProps> = (props
)
}

const RepoLinkClicked = (repoName: string) => (): void =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plain functions that are not React components should be camelCased (same for other functions)

@@ -64,6 +64,10 @@ interface Props
globbing: boolean
}

const SearchExampleClicked = (url: string) => (): void => eventLogger.log('ExampleSearchClicked', { url })
const LanguageExampleClicked = (language: string) => (): void =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of currying these functions, you could also just define the function as a closure in the component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log 3 click events for new features on Search Homepage and Repo Page
5 participants