Skip to content

Commit

Permalink
docs: add analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Dec 20, 2024
1 parent f9de86c commit 5b6fbd3
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,18 @@ import viteConfig from './vite.config'

// https://vitepress.dev/reference/site-config

const analytics = {
driver: 'fathom',

drivers: {
googleAnalytics: {
trackingId: 'UA-XXXXXXXXX-X',
},

fathom: {
siteId: 'WOLZMJDL',
},
},
}

const fathomAnalyticsHead: HeadConfig[] = [
const analyticsHead: HeadConfig[] = [
[
'script',
{
'src': 'https://cdn.usefathom.com/script.js',
'data-site': analytics.drivers?.fathom?.siteId || '',
'data-site': 'JWZWSUOY',
'defer': '',
},
],
]

const googleAnalyticsHead: HeadConfig[] = [
[
'script',
{
async: '',
src: `https://www.googletagmanager.com/gtag/js?id=${analytics.drivers?.googleAnalytics?.trackingId}`,
},
],
[
'script',
{},
`window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'TAG_ID');`,
],
]

const nav = [
{
text: 'Changelog',
Expand Down Expand Up @@ -89,13 +58,6 @@ const sidebar = [
},
]

const analyticsHead
= analytics.driver === 'fathom'
? fathomAnalyticsHead
: analytics.driver === 'google-analytics'
? googleAnalyticsHead
: []

export default withPwa(
defineConfig({
lang: 'en-US',
Expand Down

0 comments on commit 5b6fbd3

Please sign in to comment.