forked from MetaMask/metamask-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(reference): act-1447 - added capture events to reference pages (M…
- Loading branch information
1 parent
f537678
commit f0001dc
Showing
3 changed files
with
66 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
export const trackClickForSegmentAnalytics = ({ | ||
type, | ||
clickUrl, | ||
clickText, | ||
location, | ||
userId, | ||
export const trackPageViewForSegment = ({ | ||
name, | ||
path, | ||
userExperience | ||
}) => { | ||
if (window.analytics) { | ||
window.analytics.track(`CTA ${type} Clicked`, { | ||
...(clickUrl && { click_url: clickUrl }), | ||
...(clickText && { click_text: clickText }), | ||
...(location && { location }), | ||
...(userId && { user_id: userId }), | ||
window.analytics.page("Page viewed", name, { | ||
...(path && { path: path }), | ||
...(userExperience && { user_experience: userExperience }) | ||
}); | ||
} | ||
}; | ||
|
||
export const trackPageForSegmentAnalytics = ({ name, path, userId }) => { | ||
export const trackClickForSegment = ({ | ||
eventName, | ||
clickType, | ||
userExperience, | ||
responseStatus, | ||
responseMsg, | ||
timestamp, | ||
}) => { | ||
if (window.analytics) { | ||
window.analytics.page("Page view", name, { | ||
...(path && { path: path }), | ||
...(userId && { userId: userId }), | ||
window.analytics.track(`CTA ${clickType} Clicked`, { | ||
...(eventName && { event_name: eventName }), | ||
...(userExperience && { user_experience: userExperience }), | ||
...(responseStatus && { response_status: responseStatus }), | ||
...(responseMsg && { response_msg: responseMsg }), | ||
...(timestamp && { timestamp: timestamp }), | ||
}); | ||
} | ||
}; | ||
|
||
export const trackInputChangeForSegment = ({ | ||
eventName, | ||
userExperience, | ||
timestamp, | ||
}) => { | ||
if (window.analytics) { | ||
window.analytics.track(`Input changed`, { | ||
...(eventName && { event_name: eventName }), | ||
...(userExperience && { user_experience: userExperience }), | ||
...(timestamp && { timestamp: timestamp }), | ||
}); | ||
} | ||
}; |