forked from Uniswap/interface
-
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.
Merge pull request #5 from a51finance/mixpanel-integration
feat: Mixpanel integration added
- Loading branch information
Showing
5 changed files
with
40 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import mixpanel from 'mixpanel-browser'; | ||
import mixpanel from 'mixpanel-browser' | ||
const MIXPANEL_KEY = process.env.REACT_APP_MIXPANEL_KEY | ||
if (MIXPANEL_KEY === undefined) { | ||
throw new Error(`MIXPANEL_KEY must be a defined environment variable`) | ||
} | ||
mixpanel.init(MIXPANEL_KEY); | ||
|
||
mixpanel.init(MIXPANEL_KEY) | ||
|
||
// Global function to track an event | ||
export const MixPanelTrackEvent = (msg: { | ||
category: string; | ||
action: string; | ||
label?: string; | ||
category: string | ||
action: string | ||
label?: string | ||
account?: string | ||
chain?: string | ||
tokenAddress?: string | ||
}) => { | ||
// Identify the user performing the event (if applicable) | ||
// mixpanel.identify(userAgent.device); | ||
|
||
const { category, ...res } = msg; | ||
const { category, ...res } = msg | ||
|
||
// Track the event with the provided message object | ||
|
||
mixpanel.track(category, { | ||
...res, | ||
}); | ||
}; | ||
mixpanel.track(category, { | ||
...res, | ||
}) | ||
} |
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