Add Analytics

This commit is contained in:
2022-06-23 19:04:23 +02:00
parent aea65da747
commit c66fe85879
3 changed files with 67 additions and 0 deletions

21
src/utils/analytics.ts Normal file
View File

@@ -0,0 +1,21 @@
// @ts-nocheck
// Send page
export const sendPage = (path: string) => {
if (Countly) {
Countly.track_pageview()
}
}
// Send event
export const sendEvent = ({ action, segments = {}, amount = 1 }) => {
if (Countly) {
Countly.add_event({
key: action,
count: amount,
segmentation: {
...segments
}
})
}
}