You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the below setup, when using PlausibleProvider, no POST request is fired to http://localhost:8000/api/event when navigating with next/link component.
When using PlausibleProvider, the request is fired correctly under these circumstances:
on browser page reload
on browser back/forward navigation (alternate between clicking on ONE and HOME links in the example below several times to accumulate browser history — no event request will be fired, but then click on the browser navigation arrows and the requests will fire correctly).
cd into hosting directory and run docker-compose up. Login to Plausible instance and complete setup.
Create a page route inside the Next.js app directory:
app/one/page.tsx:
exportdefaultfunctionOne(){return<>ONE</>}
Update app/layout.tsx to contain two next/link links, one to navigate to page ONE, and the other to app/layout.tsx
importtype{Metadata}from'next'import{Inter}from'next/font/google'import'./globals.css'importLinkfrom'next/link'importPlausibleProviderfrom'next-plausible'constinter=Inter({subsets: ['latin']})exportconstmetadata: Metadata={title: 'Create Next App',description: 'Generated by create next app',}exportdefaultfunctionRootLayout({
children,}: {children: React.ReactNode}){return(<htmllang="en"><head>{/* <script defer data-domain="localhost" src="http://localhost:8000/js/script.local.js"></script> */}<PlausibleProviderdomain='localhost'trackLocalhost={true}enabled={true}selfHosted={true}customDomain='http://localhost:8000'/></head><bodyclassName={inter.className}><nav><Linkhref="/">HOME</Link><Linkhref="/one">ONE</Link></nav><div>{children}</div></body></html>)}
Reload home page, POST request will fire, then click on "ONE" — there will be no POST event.
Client-side navigation via next/link fires event requests correctly when plausible script is added via a <script> element (uncomment it and comment out PlausibleProvider).
The text was updated successfully, but these errors were encountered:
Problem
With the below setup, when using
PlausibleProvider
, noPOST
request is fired tohttp://localhost:8000/api/event
when navigating withnext/link
component.When using
PlausibleProvider
, the request is fired correctly under these circumstances:Steps to reproduce
cd
into the Next.js project directory and runnpm run dev
cd
intohosting
directory and rundocker-compose up
. Login to Plausible instance and complete setup.app
directory:app/one/page.tsx
:app/layout.tsx
to contain twonext/link
links, one to navigate to page ONE, and the other toapp/layout.tsx
Client-side navigation via
next/link
fires event requests correctly when plausible script is added via a<script>
element (uncomment it and comment out PlausibleProvider).The text was updated successfully, but these errors were encountered: