From 5caa9557d0fa9d986d3edabd8dd4e563257bd32d Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Mon, 22 May 2023 13:37:21 -0700 Subject: [PATCH] add additional tracker for Matomo for migration to Matomo Cloud --- .env.local.example | 2 ++ src/pages/_app.tsx | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env.local.example b/.env.local.example index 7ef0528fb6..1ded9b4f90 100644 --- a/.env.local.example +++ b/.env.local.example @@ -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= diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 5172101bd0..1cbcad9c04 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -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 (