electerious / ackee-tracker

Transfer data to Ackee.
MIT License
196 stars 22 forks source link

Client-side routing #15

Closed PabloSzx closed 4 years ago

PabloSzx commented 4 years ago

When adding ackee-tracker using Next.js and there is client-side routing I could see that the POST request sent doesn't use the current URL in the browser, but instead, the first page the user entered.

I will try to make a PR that fixes this issue.

electerious commented 4 years ago

Hey @PabloSzx and thanks for the PR. It's the intended behaviour. There're many ways to do client side routing and a URL change shouldn't always track a new visit. I recommend to use the programmatic way when doing client side routing. This way you can track page changes directly in your router: https://github.com/electerious/ackee-tracker#programmatic

There's also a Nuxt.js module and React hook available: https://github.com/bdrtsky/nuxt-ackee https://github.com/electerious/use-ackee

I will keep the issue open as I think it's a good idea to write this into the README.

electerious commented 4 years ago

I've added additional information to the README of the next version: https://github.com/electerious/ackee-tracker/commit/8506bb23399e9dbd4332bb453faddd375da7eb8e