Skip to content

Commit

Permalink
Merge pull request #542 from starknet-id/feat/add-post-hog
Browse files Browse the repository at this point in the history
feat: add post hog stats
  • Loading branch information
ayushtom authored Mar 18, 2024
2 parents c07dfa3 + 912a4f8 commit 411138e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ import { ThemeProvider, createTheme } from "@mui/material";
import { QuestsContextProvider } from "@context/QuestsProvider";
import { getCurrentNetwork } from "@utils/network";
import { constants } from "starknet";
import { PostHogProvider } from "posthog-js/react";
import posthog from "posthog-js";

// Traffic measures
if (typeof window !== "undefined") {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY as string, {
api_host: "https://app.posthog.com",
session_recording: {
recordCrossOriginIframes: true,
},
capture_pageleave: false,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).posthog = posthog;
}

export const availableConnectors = [
new InjectedConnector({ options: { id: "braavos", name: "Braavos" } }),
Expand All @@ -37,6 +52,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
const network = getCurrentNetwork();
const chains = [network === "TESTNET" ? goerli : mainnet];
const provider = jsonRpcProvider({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
rpc: (_chain: Chain) => ({
nodeUrl: process.env.NEXT_PUBLIC_RPC_URL as string,
}),
Expand Down Expand Up @@ -67,7 +83,9 @@ export function Providers({ children }: { children: React.ReactNode }) {
>
<StarknetIdJsProvider>
<ThemeProvider theme={theme}>
<QuestsContextProvider>{children}</QuestsContextProvider>
<PostHogProvider client={posthog}>
<QuestsContextProvider>{children}</QuestsContextProvider>
</PostHogProvider>
</ThemeProvider>
</StarknetIdJsProvider>
</StarknetConfig>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"maath": "^0.7.0",
"mongodb": "^4.12.1",
"next": "^14.0.1",
"posthog-js": "^1.116.2",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
Expand Down

0 comments on commit 411138e

Please sign in to comment.