add additional tracker for Matomo

for migration to Matomo Cloud
This commit is contained in:
Paul Wackerow 2023-05-22 13:37:21 -07:00
parent 841f9c1f9b
commit 5caa9557d0
No known key found for this signature in database
GPG Key ID: F4DE7CEDF0129FB6
2 changed files with 8 additions and 1 deletions

View File

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

View File

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