-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'beta' into nickytonline/decrease-tooltip-dealy
- Loading branch information
Showing
9 changed files
with
113 additions
and
20 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
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,16 +1,41 @@ | ||
import posthog from "posthog-js"; | ||
import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; | ||
|
||
interface AnalyticEvent { | ||
title: string; | ||
property: string; | ||
value: string; | ||
} | ||
|
||
function initiateAnalytics() { | ||
// eslint-disable-next-line | ||
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_ID as string, { api_host: "https://app.posthog.com" }); | ||
} | ||
|
||
function captureAnayltics(analyticsTitle: string, analyticsProperty: string, analyticsValue: string) { | ||
const analyticsObject: Record<string, string> = {}; | ||
/** | ||
* Captures an analytic event | ||
* | ||
* @param {string} title - The title of the event | ||
* @param {string} property - The property of the event | ||
* @param {string} value - The value of the event | ||
*/ | ||
function useAnalytics() { | ||
const { user } = useSupabaseAuth(); | ||
|
||
return { | ||
captureAnalytics({ title, property, value }: AnalyticEvent) { | ||
const analyticsObject: Record<string, string> = {}; | ||
|
||
analyticsObject[property] = value; | ||
|
||
analyticsObject[analyticsProperty] = analyticsValue; | ||
// if a user is not logged in, Posthog will generate an anonymous ID | ||
if (user) { | ||
posthog.identify(user.user_metadata.sub); | ||
} | ||
|
||
posthog.capture(analyticsTitle, analyticsObject); | ||
posthog.capture(title, analyticsObject); | ||
}, | ||
}; | ||
} | ||
|
||
export { initiateAnalytics, captureAnayltics }; | ||
export { initiateAnalytics, useAnalytics }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "@open-sauced/insights", | ||
"description": "🍕The dashboard for open source discovery.", | ||
"keywords": [], | ||
"version": "1.71.0-beta.10", | ||
"version": "1.71.0-beta.14", | ||
"author": "Brian Douglas <[email protected]>", | ||
"private": true, | ||
"license": "Apache 2.0", | ||
|
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