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

set enableLinkTracking to false by default or to true for all renders #26

Open
aarowman opened this issue Jun 17, 2020 · 1 comment
Open

Comments

@aarowman
Copy link

Currently enableLinkTracking is set to true by default (per the doc of this library), but we still have issues like #25 since this is normally an issue with SPAs. Anytime React components re-render, then the event listener is lost and those links aren't tracked anymore.

This results in inconsistent behavior (links are tracked on initial page load, but they're not tracked if a user navigates the site and causes component re-renders)

So we either have to:

  1. Call enableLinkTracking again for each render (basically every component that has a link), which gets tedious and has inconsistent behavior if missed.. or
  2. Call trackLink explicitly using our own onClick handler, which is also tedious

I suggest we set it to false by default and let the client decide how to proceed, or somehow enable this to be set again even on re-renders

@guillaumeparis2000
Copy link
Owner

I'm short of time for the moment, feel free to open a PR. Thanks

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