add additional tracker for Matomo

for migration to Matomo Cloud
website-matomo
Paul Wackerow 2 years ago
parent 841f9c1f9b
commit 5caa9557d0
No known key found for this signature in database
GPG Key ID: F4DE7CEDF0129FB6
  1. 2
      .env.local.example
  2. 7
      src/pages/_app.tsx

@ -10,4 +10,6 @@ GITHUB_TOKEN_READ_ONLY=
# Matomo
NEXT_PUBLIC_MATOMO_URL=
NEXT_PUBLIC_MATOMO_SITE_ID=
NEXT_PUBLIC_MATOMO_SECONDARY_URL=
NEXT_PUBLIC_MATOMO_SECONDARY_SITE_ID=
NEXT_PUBLIC_MATOMO_OPT_OUT_URL=

@ -1,7 +1,7 @@
import { ChakraProvider, localStorageManager } from '@chakra-ui/react';
import { AppProps } from 'next/app';
import { useEffect } from 'react';
import { init } from '@socialgouv/matomo-next';
import { init, push } from '@socialgouv/matomo-next';
import { Layout } from '../components/layouts';
@ -17,6 +17,11 @@ export default function App({ Component, pageProps }: AppProps) {
url: process.env.NEXT_PUBLIC_MATOMO_URL!,
siteId: process.env.NEXT_PUBLIC_MATOMO_SITE_ID!
});
push([
'addTracker',
process.env.NEXT_PUBLIC_MATOMO_SECONDARY_URL!,
process.env.NEXT_PUBLIC_MATOMO_SECONDARY_SITE_ID!
]);
}, []);
return (

Loading…
Cancel
Save