diff --git a/docusaurus.config.js b/docusaurus.config.js index 51a47dc..a044a05 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -44,12 +44,15 @@ const config = { scripts: [ { - src: 'https://plausible.nicelycomposed.codes/js/script.outbound-links.js', - defer: 'true', - 'data-domain': 'yevi.org', + src: 'https://plausible.nicelycomposed.codes/js/pa-MT46IhokfYZrpmWFXgQq-.js', + async: true, }, ], + clientModules: [ + require.resolve('./src/components/plausible-analytics/init.js'), + ], + presets: [ [ 'classic', diff --git a/src/components/plausible-analytics/init.js b/src/components/plausible-analytics/init.js new file mode 100644 index 0000000..c269f0f --- /dev/null +++ b/src/components/plausible-analytics/init.js @@ -0,0 +1,6 @@ +import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; + +if (ExecutionEnvironment.canUseDOM) { + window.plausible = window.plausible || function () { (plausible.q = plausible.q || []).push(arguments) }, plausible.init = plausible.init || function (i) { plausible.o = i || {} }; + plausible.init(); +} \ No newline at end of file