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

310 - Revise gtag script and add trackExperimentPageClick to search card components #374

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

nozomione
Copy link
Member

@nozomione nozomione commented Oct 1, 2024

Issue Number

Epic: #302

Related Issue #310

Purpose/Implementation Notes

I've revised the gtag script and dimension names, and included the missing gtag.trackExperimentPageClick method to SearchCardHeader and SearchCardFooter based on local debugging while setting up the Refine.bio Web -Dev property in the analytics account.

I've completed the setup for #310 and it is ready for your review. Thank you David!

Types of changes

  • Refactor (addresses code organization and design mentioned in corresponding issue)
  • Bugfix (non-breaking change which fixes an issue)

Functional tests

N/A

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Screenshots

N/A

…and SearchCardFooter (was missing), change the passed argument values for gtag.trackDownloadRnaSeqCompendia in compendia's Download component, revise gtag.trackRegeneratedDataset and dimensions and adjust its comment, fix any bugs found during debugging
@nozomione nozomione self-assigned this Oct 1, 2024
Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
refinebio-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 9:37pm

@nozomione nozomione added the bug Something isn't working label Oct 1, 2024
@@ -101,7 +102,7 @@ const trackExploredUsageClick = (link) => {
}
// tracks internal and external link clicks
const trackLink = (link) => {
if (link.startsWith('http')) {
if (typeof link === 'string' && link.startsWith('http')) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Although this fix has already been added the pending PR #369 (to prevent an error encountered during the development), I've also added here for the same reason.

'dataset_id',
'one_off_experiment_download',
'regenerated_download_options_change',
Copy link
Member Author

Choose a reason for hiding this comment

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

The prefix of this dimension name has been changed to regenerated to differentiate between the dataset and the regenerative dataset.

@@ -51,6 +51,7 @@ const supportedDimensions = [
'filter_combination',
'filter_type',
'toggled_filter_item',
'shared_dataset_id',
Copy link
Member Author

Choose a reason for hiding this comment

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

Same here, the shared prefix has been added to the shared dataset to differentiate it from the dataset in GA report.

Comment on lines +83 to +95
const initial = datasetOptionsKeys
.map((key) => `${getReadable(key, dataset[key])}`)
.join('|')

if (regeneratedDataset) {
const changes = datasetOptionsKeys
.map((key) => `${getReadable(key, regeneratedDataset[key])}`)
.join('|')

return `${initial} -> ${changes}`
}

return initial
Copy link
Member Author

Choose a reason for hiding this comment

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

I've revised this method to return the download options changes if any, otherwise returns the initial download options value.

const response = await downloadCompendia(id)
gtag.trackCompendiaDownload(response)
gtag.trackCompendiaDownload(userSelectedOrganism)
Copy link
Member Author

Choose a reason for hiding this comment

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

A wrong argument value was passed here, thus I've corrected.

const handleClick = () => {
push(`/experiments/${accessionCode}/${formatURLString(title)}`)
setSearch({ ...search, ref: 'search' })
gtag.trackExperimentPageClick(SearchCardFooter)
Copy link
Member Author

Choose a reason for hiding this comment

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

This tracking method was missing from this component, so I've included.

@@ -14,6 +15,11 @@ export const SearchCardHeader = ({
const { search, setSearch } = useSearchManager()
const { setResponsive } = useResponsive()

const handleClick = () => {
setSearch({ ...search, ref: 'search' })
gtag.trackExperimentPageClick(SearchCardHeader)
Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above, I've included the missing tracking method here.

@nozomione nozomione marked this pull request as ready for review October 1, 2024 00:27
@nozomione nozomione mentioned this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant