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

Track Custom Query Parameters #86

Open
guttermouth99 opened this issue Feb 2, 2023 · 4 comments
Open

Track Custom Query Parameters #86

guttermouth99 opened this issue Feb 2, 2023 · 4 comments

Comments

@guttermouth99
Copy link

guttermouth99 commented Feb 2, 2023

Hey,

I was wondering if there is an easy way to implement tracking of custom query parameters like described in the plausible documentation: https://plausible.io/docs/custom-query-params

I know its possible to set custom scriptProps. So I assume replacing the script with the .manual would solve the first step described in the plausible documentation.

However, I am unsure how to add the second part. Is it simply possible to add this to the script of my _document.js? I am worried this might intervene with the ?

@4lejandrito
Copy link
Owner

Hi!

The first step can be achieved by setting the manualPageviews prop to PlausibleProvider.

I'll look into the custom query params feature when I have time.

Thanks!

@kachkaev
Copy link

@guttermouth99 have you found a solution? It'd be great to have some simple way of allow-listing certain get params without having to do anything complex like described in https://plausible.io/docs/custom-query-params.

@4lejandrito
Copy link
Owner

4lejandrito commented Jul 18, 2023

Hey @kachkaev, @guttermouth99,

I have an initial proposal to implement support for custom query parameters. It exposes the prepareUrl function and can be used like this:

import { prepareUrl } from 'next-plausible'

plausible('pageview', {
  u: prepareUrl('param1', 'param2'),
})

Would that be enough?

Please let me know your thoughts.

@michael-ravelhq
Copy link

Are there any updates on whether there's a way of doing this?

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

4 participants