Skip to content

Commit

Permalink
refactor: minor fathom analytics improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Apr 30, 2024
1 parent e16a2a4 commit cdd749c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/runtime/registry/fathom-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@ import { registryScript } from '../utils'
import type { RegistryScriptInput } from '#nuxt-scripts'

export const FathomAnalyticsOptions = object({
site: string(), // site is required
/**
* The Fathom Analytics site ID.
*/
site: string(),
/**
* The Fathom Analytics tracking mode.
*/
spa: optional(union([literal('auto'), literal('history'), literal('hash')])),
/**
* Automatically track page views.
*/
auto: optional(boolean()),
/**
* Enable canonical URL tracking.
*/
canonical: optional(boolean()),
/**
* Honor Do Not Track requests.
*/
honorDnt: optional(boolean()),
})

Expand Down Expand Up @@ -46,7 +61,7 @@ export function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(_options?
return acc
}, {}),
},
schema: FathomAnalyticsOptions,
schema: import.meta.dev ? FathomAnalyticsOptions : undefined,
scriptOptions: {
use() {
return window.fathom
Expand Down

0 comments on commit cdd749c

Please sign in to comment.