瀏覽代碼

fix matomo plugin

Olivier Massot 9 月之前
父節點
當前提交
68f5e58d7e
共有 1 個文件被更改,包括 8 次插入14 次删除
  1. 8 14
      plugins/matomo.client.ts

+ 8 - 14
plugins/matomo.client.ts

@@ -1,28 +1,22 @@
 import VueMatomo from 'vue-matomo'
 
 const OPENTALENT_PROD_ID = 196
-const OPENTALENT_TEST5_ID = 197
-const OPENTALENT_LOCAL_ID = 197
+const OPENTALENT_TEST_ID = 197
 
 export default defineNuxtPlugin((nuxtApp) => {
+  const router = useRouter()
+
   // @see https://github.com/AmazingDreams/vue-matomo
   nuxtApp.vueApp.use(VueMatomo, {
-    router: nuxtApp.router,
-    host: 'https://stats.2iopenservice.com',
-    siteId: OPENTALENT_LOCAL_ID,
+    router,
+    host: 'https://stats.2iopenservice.com/',
+    siteId: process.env.NODE_ENV === 'production' ? OPENTALENT_PROD_ID : OPENTALENT_TEST_ID,
     enableLinkTracking: true,
     requireConsent: false, // Mettre à true si vous avez besoin du consentement RGPD
     trackInitialView: true,
     disableCookies: false, // Mettre à true pour respecter certaines règles RGPD
     requireCookieConsent: false, // Mettre à true pour demander le consentement pour les cookies
-    debug: process.env.NODE_ENV !== 'production'
+    debug: process.env.NODE_ENV !== 'production',
+    trackSiteSearch: true
   })
-
-  // window._paq.push(['trackPageView']); // Pour suivre les visites sur vos pages
-
-  // @see https://scripts.nuxt.com/scripts/analytics/matomo-analytics
-  // useScriptMatomoAnalytics({
-  //   matomoUrl: 'https://stats.2iopenservice.com',
-  //   siteId: 196,
-  // })
 })