Skip to content

Commit f400955

Browse files
authored
Move from unmaintainer plausible-tracker to plausible-client (#185)
* Move from unmaintainer plausible-tracker to plausible-client * Update API
1 parent 5ac14f7 commit f400955

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"jstransformer-markdown-it": "^3.0.0",
2929
"nanodelay": "^2.0.2",
3030
"nanostores": "^1.0.1",
31-
"plausible-tracker": "^0.3.9",
31+
"plausible-client": "^1.1.0",
3232
"postcss": "^8.5.3",
3333
"postcss-media-minmax": "^5.0.0",
3434
"postcss-mixins": "^11.0.3",

pnpm-lock.yaml

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

view/analytics/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import Plausible from 'plausible-tracker'
1+
import { Plausible } from 'plausible-client'
22

3-
let trackEvent: ReturnType<typeof Plausible>['trackEvent']
3+
let trackEvent: (...args: Parameters<Plausible['trackEvent']>) => void
44

55
if (process.env.NODE_ENV === 'production') {
6-
let tracker = Plausible({
6+
let tracker = new Plausible({
7+
apiHost: 'https://plausible.io',
78
domain: COLOR_FN === 'oklch' ? 'oklch.com' : 'lch.oklch.com'
89
})
910

10-
tracker.trackPageview()
11-
trackEvent = tracker.trackEvent
11+
trackEvent = (...args) => {
12+
tracker.trackEvent(...args).catch((e: unknown) => {
13+
throw e
14+
})
15+
}
16+
trackEvent('pageview')
1217
} else {
1318
trackEvent = () => {}
1419
}

0 commit comments

Comments
 (0)