Skip to content

Commit

Permalink
should work way better with this
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoistP committed Dec 19, 2024
1 parent 4c4271b commit 8075629
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from 'react'
import { QueryClient, QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux'

Expand Down Expand Up @@ -25,12 +26,14 @@ import {
metaMaskHooks,
parseAllowedChain,
} from '@realtoken/realt-commons'
import { init as initMatomoNext } from '@socialgouv/matomo-next'

import { getCookie } from 'cookies-next'
import { Provider as JotaiProvider } from 'jotai'

import { Favicon } from 'src/assets'
import { Head, MainLayout } from 'src/components/layouts'
import useMatomoTracker from 'src/hooks/useMatomoTracker'
import 'src/i18next'
import { resources } from 'src/i18next'
import { MantineProviders } from 'src/providers'
Expand All @@ -56,6 +59,8 @@ const dashbordChains: ChainSelectConfig<RealtChains> = {

const env = process.env.NEXT_PUBLIC_ENV ?? 'development'
const walletConnectKey = process.env.NEXT_PUBLIC_WALLET_CONNECT_KEY ?? ''
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL ?? ''
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID ?? ''

const readOnly = getReadOnlyConnector(dashbordChains)
const walletConnect = getWalletConnectV2(
Expand Down Expand Up @@ -91,6 +96,23 @@ const App = ({ Component, pageProps, colorScheme, env }: AppProps) => {
}
Router.events.on('routeChangeComplete', scrollToTop)

// Event tracking
useEffect(() => {
// eslint-disable-next-line no-underscore-dangle
if (!window._paq) {
console.log('initMatomoNext')
// Triggered twice on page load when using strict mode in dev
initMatomoNext({
url: MATOMO_URL,
siteId: MATOMO_SITE_ID,
disableCookies: false, // TODO: cookie consent banner
// excludeUrlsPatterns: [/^\/login.php/, /\?token=.+/],
})
}
}, [])

useMatomoTracker()

return (
<QueryClientProvider client={queryClient}>
<JotaiProvider>
Expand Down

0 comments on commit 8075629

Please sign in to comment.