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 download clicks #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Track download clicks #86

wants to merge 1 commit into from

Conversation

bumi
Copy link
Contributor

@bumi bumi commented Mar 2, 2022

@@ -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>
Copy link
Contributor Author

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');
Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

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

@jankoegel
Copy link
Contributor

@bumi do you still want to track this in the Rails app?

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

Successfully merging this pull request may close these issues.

2 participants