-
Notifications
You must be signed in to change notification settings - Fork 10
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 download clicks #86
base: main
Are you sure you want to change the base?
Conversation
@@ -29,6 +29,7 @@ export default function App() { | |||
<meta charSet="utf-8" /> | |||
<meta name="viewport" content="width=device-width,initial-scale=1" /> | |||
<script defer data-domain="getalby.com" src="https://squirrel.getalby.com/js/plausible.js"></script> | |||
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can not use window
here because of remix (rendering things on the server)
I don't know yet how this would be done in the remix context
@@ -26,6 +26,11 @@ const BrowserIcons = { | |||
const DefaultLink = "https://github.com/getAlby/lightning-browser-extension"; | |||
|
|||
function Install({ style }) { | |||
|
|||
function trackDownload() { | |||
plausible('Download'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not defined here because of the remix context. need to see how to define a window.plausible
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's an example where they detect whether they're on the server and set an empty function as a fallback:
https://remix.run/docs/en/v1/guides/constraints#uselayouteffect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example also looks relevant, they fix a localstorage
call (which has the same problem as window
on the server): https://remix.run/docs/en/v1/guides/constraints#rendering-with-browser-only-apis
@bumi do you still want to track this in the Rails app? |
https://plausible.io/docs/custom-event-goals