-
Notifications
You must be signed in to change notification settings - Fork 364
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
chore: [M3-6497] - Remove Google Analytics and clean up custom events #9266
chore: [M3-6497] - Remove Google Analytics and clean up custom events #9266
Conversation
Passing run #4360 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
|
||
/* | ||
* If in the future, we want to hook into every single | ||
* async action for the purpose of sending the request data | ||
* to Google Tag Manager, we can uncomment out the following | ||
* .then() and .catch() on return Axios(config) | ||
*/ | ||
|
||
// .then(response => { | ||
// /* | ||
// * This is sending an event to the Google Tag Manager | ||
// * data layer. This is important because it lets us track | ||
// * async actions as custom events | ||
// */ | ||
// if ((window as any).dataLayer) { | ||
// (window as any).dataLayer = (window as any).dataLayer || []; | ||
// (window as any).dataLayer.push({ | ||
// 'event': 'asyncActionSuccess', | ||
// 'url': response.config.url, | ||
// 'method': response.config.method, | ||
// }); | ||
// }; | ||
// return response; | ||
// }) | ||
// .catch(e => { | ||
// /* | ||
// * This is sending an event to the Google Tag Manager | ||
// * data layer. This is important because it lets us track | ||
// * async actions as custom events | ||
// */ | ||
// if ((window as any).dataLayer) { | ||
// (window as any).dataLayer = (window as any).dataLayer || []; | ||
// (window as any).dataLayer.push({ | ||
// 'event': 'asyncActionFailure', | ||
// 'url': e.response.config.url, | ||
// 'method': e.response.config.method, | ||
// }); | ||
// }; | ||
// return Promise.reject(e); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the removal of GA and GTM, we can remove this comment block - it's just taking up space.
const fireGAEvent = (label: string) => { | ||
sendEvent({ | ||
action: 'Click:link', | ||
category: 'Linode Create API CLI Awareness Modal', | ||
label, | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Essentially used the sendApiAwarenessClick event in place of this function in order to keep events in src/utilities/analytics.tsx
where we can.
action: `Click:link`, | ||
label: 'Disk resize failed toast', | ||
}) | ||
() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the cause of a bug. 🙃 sendEvent
was firing here every time the toast displayed, rather than just when the link on the toast was clicked.
sendEvent({ | ||
category: 'Linode Action Menu', | ||
action: 'Open Action Menu', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was being called again with recent refactoring of the action menu, so I uncommented it here.
// getAll.ts | ||
export const sendFetchAllEvent = ( | ||
eventLabel: string, | ||
eventValue: number | ||
): void => { | ||
sendEvent({ | ||
category: 'Search', | ||
action: 'Data fetch all entities', | ||
label: eventLabel, | ||
value: eventValue, | ||
}); | ||
}; | ||
|
||
// TagImportDrawer.tsx | ||
export const sendImportDisplayGroupSubmitEvent = ( | ||
eventLabel: string, | ||
eventValue: number | ||
): void => { | ||
sendEvent({ | ||
category: 'dashboard', | ||
action: 'import display groups', | ||
label: eventLabel, | ||
value: eventValue, | ||
}); | ||
}; | ||
|
||
// LinodeThemeWrapper.tsx | ||
export const sendSpacingToggleEvent = (eventLabel: string): void => { | ||
// AC 8/24/2020: disabling this event to reduce hits on GA as this seems to not be used | ||
// sendEvent({ | ||
// category: 'Theme Choice', | ||
// action: 'Spacing Toggle', | ||
// label: eventLabel | ||
// }); | ||
}; | ||
|
||
// LinodeThemeWrapper.tsx | ||
export const sendThemeToggleEvent = (): void => { | ||
// AC 9/24/2020: disabling this event to reduce hits on GA as this seems to not be used | ||
// sendEvent({ | ||
// category: 'Theme Choice', | ||
// action: 'Theme Toggle', | ||
// label: eventLabel | ||
// }); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of these events are currently in use, so I removed them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also be a tech story or just not included at all in the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with any of these options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with any of these options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work on this migration @mjac0bs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@@ -147,7 +136,9 @@ const ApiAwarenessModal = (props: Props) => { | |||
<ExternalLink | |||
text="personal access token" | |||
link="/profile/tokens" | |||
onClick={() => fireGAEvent('personal access token')} | |||
onClick={() => | |||
sendApiAwarenessClickEvent('link', 'personal access token') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, Is the first argument typed or can it be anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any string, to allow for an action like "Click:" where the input type could be a link, named tab, icon...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s unrelated to this PR but am wondering if we should eventually type this so we can chose from a limited set of events. The idea is that we can get dupes, events with different cases etc. And maybe in the future when we harvest it will be important to be able to filter events by types, or at least some events maybe be easier to group or just find. Just a thought!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's a good idea. Our current events are kind all over the place (especially in regard to action
s), and I'm not sure how we'd best get those down to a limited set, but at the very least we could type-enforce for more consistency with new events. I'll document as a follow up task.
Description 📝
Final Google Analytics -> Adobe Analytics migration PR with the clean up to remove GA from Cloud Manager. We're finally deprecating GA in our 6/26 release!
TODO:
REACT_APP_GA_ID
andREACT_APP_GTM_ID
Major Changes 🔄
List highlighting major changes
src/utilities/ga
andsrc/utilities/ga.test.ts
tosrc/utilities/analytics.ts
andsrc/utilities/analytics.test.ts
.react-ga
as a package.GA_ID
andGTM_ID
environment variables.sendCreateBucketEvent
when an OBJ storage bucket is created -- we used to track this, but it seems to have gotten dropped when refactoring components.How to test 🧪
REACT_APP_GA_ID
set in your local.env
. (Reach out if you need this.)REACT_APP_ADOBE_ANALYTICS_URL
set in your local.env
. (Reach out if you need this.)yarn up
src/utilities/analytics.ts
for custom events to test.yarn cy:run