mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-22 01:24:49 +03:00
Add proxied Plausible analytics using Docosaurus (#2370)
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
This commit is contained in:
parent
987c1d2748
commit
481e85901b
@ -3,7 +3,9 @@ const lightCodeTheme = require('prism-react-renderer/themes/github')
|
||||
const autoImportTabs = require('./src/remark/auto-import-tabs')
|
||||
const fileExtSwitcher = require('./src/remark/file-ext-switcher')
|
||||
|
||||
const includeCurrentVersion = process.env.DOCS_INCLUDE_CURRENT_VERSION === 'true'
|
||||
const includeCurrentVersion =
|
||||
process.env.DOCS_INCLUDE_CURRENT_VERSION === 'true'
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
module.exports = {
|
||||
@ -213,7 +215,7 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
],
|
||||
scripts: ['/scripts/posthog.js', '/js/fix-multiple-trailing-slashes.js'],
|
||||
scripts: getScripts(),
|
||||
plugins: [
|
||||
'plugin-image-zoom',
|
||||
async function myPlugin(context, options) {
|
||||
@ -298,3 +300,21 @@ module.exports = {
|
||||
],
|
||||
],
|
||||
}
|
||||
|
||||
function getScripts() {
|
||||
const scripts = [
|
||||
'/scripts/posthog.js',
|
||||
'/js/fix-multiple-trailing-slashes.js',
|
||||
]
|
||||
|
||||
if (isProduction) {
|
||||
// Using Cloudflare Workers to proxy the analytics script
|
||||
scripts.push({
|
||||
src: '/waspara/wasp/script.js',
|
||||
defer: true,
|
||||
'data-domain': 'wasp-lang.dev',
|
||||
'data-api': '/waspara/wasp/event',
|
||||
})
|
||||
}
|
||||
return scripts
|
||||
}
|
||||
|
@ -59,13 +59,6 @@ const Index = () => {
|
||||
content="Develop full-stack web apps without boilerplate."
|
||||
/>
|
||||
<meta property="twitter:image" content={coverPhotoAbsoluteUrl} />
|
||||
{/* Using Cloudflare Workers to proxy the analytics script */}
|
||||
<script
|
||||
defer
|
||||
data-domain="wasp-lang.dev"
|
||||
data-api="/waspara/wasp/event"
|
||||
src="/waspara/wasp/script.js"
|
||||
></script>
|
||||
</Head>
|
||||
<Nav />
|
||||
<div className="min-h-screen">
|
||||
|
Loading…
Reference in New Issue
Block a user