4lejandrito / next-plausible

Simple integration for https://nextjs.org and https://plausible.io analytics
https://next-plausible.vercel.app
MIT License
593 stars 32 forks source link

Plausible not detected on website - 404 script error #85

Open jtiulentino opened 1 year ago

jtiulentino commented 1 year ago

Hi, we're new to using next-plausible and just installed v3.7.1.

We followed the instructions here for our _app.js file:

<PlausibleProvider domain="domain.com" enabled={true}>
    <Component {...pageProps} />
</PlausibleProvider>

We're using next dev to run both locally and in prod.

We're getting this error in the browser console, both locally and in prod:

Screenshot 2023-02-01 at 15 40 09

Any pointers you have would be appreciated! We also followed the Troubleshooting guide in the Plausible docs but got stuck there as well.

4lejandrito commented 1 year ago

Hi @jtiulentino!

Can you please paste your next.config.js file?

jtiulentino commented 1 year ago

sure thing!

const { withPlausibleProxy } = require("next-plausible");

/** @type {import('next').NextConfig} */
const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    webpack: (config, { isServer }) => {
        if (isServer) {
            require("./sitemap-utils/generate-sitemap");
        }
        return config;
    },
    images: {
        domains: [
            "storage.googleapis.com",
            "cdn.sanity.io",
            "***.supabase.co",
        ],
    },
    experimental: {
        fontLoaders: [{ loader: "@next/font/google", options: { subsets: ["latin"] } }],
    },
};

module.exports = withPlausibleProxy()(nextConfig);