From edf24dbc79bfd2a144bb3ffeb6149d90a43f2840 Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Tue, 17 Sep 2024 13:38:03 +0200 Subject: [PATCH] chore: add missing plugin --- docusaurus.config.ts | 1 + src/plugins/analytics/index.js | 52 ++++++---------------------------- 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 759bf1b93..a91170438 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -210,6 +210,7 @@ const config: Config = { }, } satisfies Preset.ThemeConfig, plugins: [ + require.resolve("./src/plugins/analytics"), [ "docusaurus-pushfeedback", { diff --git a/src/plugins/analytics/index.js b/src/plugins/analytics/index.js index 02c2d0a61..919c0bf81 100644 --- a/src/plugins/analytics/index.js +++ b/src/plugins/analytics/index.js @@ -1,60 +1,24 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const path = require("path") - module.exports = function (context) { return { - name: "docusaurus-plugin-google-analytics", - - getClientModules() { - return [path.resolve(__dirname, "./analytics")] - }, + name: "ory-plugin-analytics", injectHtmlTags() { return { headTags: [ - { - tagName: "script", - innerHTML: ` -window.dataLayer = window.dataLayer || []; -function gtag(){dataLayer.push(arguments);} - -gtag('consent', 'default', { - 'analytics_storage': 'allowed', - 'ad_storage': 'denied', - 'ads_data_redaction': true -}); - -gtag('consent', 'default', { - 'ad_storage': 'denied', - 'analytics_storage': 'denied', - 'ads_data_redaction': true, - 'region': ['BE','BG','CZ','DK','DE','EE','IE','EL','ES','FR','HR','IT','CY','LV','LT','LU','HU','MT','NL','AT','PL','PT','RO','SI','SK','FI','SE','US-CA'] -}); - `, - }, { tagName: "script", attributes: { - async: true, - src: "https://www.googletagmanager.com/gtag/js?id=UA-71865250-1", + type: "text/javascript", + src: "https://app.termly.io/resource-blocker/3563b8d6-caf2-41c3-a821-9d0eb05a7409?autoBlock=on", }, }, { tagName: "script", - innerHTML: ` -window.dataLayer = window.dataLayer || []; -function gtag(){dataLayer.push(arguments);} -gtag('js', new Date()); - -gtag('config', 'G-J01VQCC9Y9'); // automatically anonymized -gtag('config', 'UA-71865250-1', { 'anonymize_ip': true }); - `, + attributes: { + type: "text/javascript", + "data-categories": "essential", + src: "https://www.ory.sh/scripts/cookies.js", + }, }, ], }