Analytics

You can add any analytics tool to your blog.

By default, X comes with built-in integrations to work with:

but you can add any other analytics tool.

How to configure Pirsch

Open the file app.config.ts and configure the analytics property:

    analytics: {
        provider: 'pirsch', 
        pirsch: {
            code: 'YOUR_PIRSCH_CODE'
        }
}
Replace YOUR_PIRSCH_CODE with your Pirsch code.

How to configure Plausible

Open the file app.config.ts and configure the analytics property:

    analytics: {
        provider: 'plausible',
            plausible: {
            domain: 'YOUR_DOMAIN'
        }
}
Replace YOUR_DOMAIN with your domain

How to add another analytics tool

You have to modify the nuxt.config.ts file to add the script of the analytics tool.

For example, to add Google Analytics, you can add the following script:

export default {
    app: {
        head: {
            script: [
                {
                    src: 'https://www.googletagmanager.com/gtag/js?id=YOUR_GOOGLE_ANALYTICS_ID',
                    async: true,
                },
                {
                    innerHTML: `
                        window.dataLayer = window.dataLayer || [];
                        function gtag(){dataLayer.push(arguments);}
                        gtag('js', new Date());
                        gtag('config', 'YOUR_GOOGLE_ANALYTICS_ID');
                    `,
                },
            ],
        },
    },
}