Turbolinks Compatibility #462
ymolodtsov
started this conversation in
Anything Else
Replies: 1 comment 1 reply
-
Yes, first make sure to define the plausible function when including your script: <script async defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script> Then you can trigger a pageview with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My static blog uses Turbolinks and I don't think Plausible supports it – it fails to see any page views after the first load. They way I dealt with it with Google Analytics is by manually invoking it when the Turbolinks event happened, like this:
document.addEventListener('turbolinks:load', event => { if (typeof ga === 'function') { ga('set', 'location', event.data.url); ga('send', 'pageview'); } });
Is there a comparable way to manually tell Plausible there's a new page load?
I wasn't able to find any mentions of it on the website, in the docs or in this forum.
Beta Was this translation helpful? Give feedback.
All reactions