Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next 14.1.4 analytics not working anymore #120

Closed
mistralaix opened this issue Apr 5, 2024 · 4 comments
Closed

Next 14.1.4 analytics not working anymore #120

mistralaix opened this issue Apr 5, 2024 · 4 comments

Comments

@mistralaix
Copy link

Here's my configuration:

package.json

"next": "^14.1.4",
"next-plausible": "^3.12.0",

next.config.json

module.exports = withPlausibleProxy()(withMDX(nextConfig));

app/layout.tsx

import PlausibleProvider from "next-plausible";

...

<html lang="en">
      <head>
        <PlausibleProvider domain="domain.com" />
      </head>
....

I implemented the MDX library and had to update the Next version and next-plausible version. Before that, I was getting analytics. Since this update, I don't get any analytics on my dashboard

Capture d’écran 2024-04-04 à 19 13 10

On one page, I also put a custom event and I don't receive anything either:

page.tsx

"use client";

import { usePlausible } from "next-plausible";

...

const plausible = usePlausible();

...

<button onClick={() => plausible('test')}>Test</button>

Thanks in advance for your help!

@i8ramin
Copy link

i8ramin commented May 10, 2024

We are experiencing the same thing. Had to disable the proxy and things started working again. But would much prefer having the proxy in place

@58bits
Copy link

58bits commented May 11, 2024

If you are hosting on Vercel - you'll need to setup the script and rewrites manually using vercel.json

For example vercel.json

{
  "rewrites": [
    {
      "source": "/modules/js/script.js",
      "destination": "https://plausible.io/js/script.js"
    },
    {
      "source": "/modules/api/event",
      "destination": "https://plausible.io/api/event"
    }
  ]
}

And then place the following script tag in the head section of your root layout.tsx

<head>
     <script
          defer
          data-domain="yourdomainhere"
          data-api="/modules/api/event"
          src="/modules/js/script.js"
        />
</head>

@4lejandrito
Copy link
Owner

Hey guys I cannot reproduce this. I've set up this page using the app directory and I see the visits in the dashboard.

Could you please create a sample reproduction repo, or a link to a site that has this issue so that I can see what's going on?

@SkyM
Copy link

SkyM commented May 20, 2024

Thank you @58bits, this worked for us on Vercel. We installed Plausible for the first time a few days ago. Traffic worked for a few days before suddenly dropping to zero. Deployed this fix and immediately saw reporting again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants