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

Question: Usage without autoPageviews: true #19

Open
madebyfabian opened this issue Mar 17, 2024 · 2 comments
Open

Question: Usage without autoPageviews: true #19

madebyfabian opened this issue Mar 17, 2024 · 2 comments

Comments

@madebyfabian
Copy link

Hi there! I wanted to use Plausible in a Nuxt project and exclude some of my routes from being automatically tracked as pageview.

Since this is currently not possible with the plausible-tracker, I thought of setting autoPageviews: false and manually tracking them, excluding the paths I don't want to manually.

But where would be the best option to do that? In a Nuxt client middleware? Or in a route watcher in app.vue? Or maybe the page:finish hook? From the implementation of this nuxt module, it wasn't super clear for me on how to do it.

Appreciate your input!

@Barbapapazes
Copy link
Contributor

Hey @madebyfabian, I think the easier way is to add manually the tracker in each page you want to track using https://github.com/nuxt-modules/plausible#usetrackpageview

<script setup>
useTrackPageview()
</script>

See usage in the UnJS website: https://github.com/unjs/website/blob/main/pages/index.vue#L21

Do not hesite if you have more question!

@madebyfabian
Copy link
Author

Thanks for your answer! I think there is now a native way to do that in the Plausible settings directly: https://plausible.io/docs/top-pages#block-traffic-from-specific-pages-or-sections

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

2 participants