How to simply integrate Fathom Analytics?

Hey guys, I am trying to figure it out how to implement Fathom Analytics as plugin in Nuxt3 without any other package. I created plugin in my plugins folder: fathom.client.ts, but I am not sure if I am right. Can you help me?
import * as Fathom from 'fathom-client';

export default defineNuxtPlugin((nuxtApp) => {
Fathom.load('###', {
url: '###',
});

Fathom.trackPageview();
});
import * as Fathom from 'fathom-client';

export default defineNuxtPlugin((nuxtApp) => {
Fathom.load('###', {
url: '###',
});

Fathom.trackPageview();
});
If it is possible I want to define variables in my nuxt.config.ts file like this:
export default defineNuxtConfig({
fathom: {
siteId: '###',
url: '###',
},
});
export default defineNuxtConfig({
fathom: {
siteId: '###',
url: '###',
},
});
4 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
harlan
harlan3y ago
you can just load the script via the app.head config
harlan
harlan3y ago
GitHub
harlanzw.com/nuxt.config.ts at main · harlan-zw/harlanzw.com
My personal website built with Nuxt v3 and Nuxt Content v2. - harlanzw.com/nuxt.config.ts at main · harlan-zw/harlanzw.com
harlan
harlan3y ago
or are you trying to build a module or something
Want results from more Discord servers?
Add your server