-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Instrument toolbar #2859
Instrument toolbar #2859
Conversation
@mariusandra when you get a chance to review this would you mind making sure all the events are properly triggered? Want to make sure we don't have weird events coming in that affect our metrics. I also ran into an issue sending events with |
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.
The big issue with this PR is that you're using posthog-js
, which won't work here. Instead you should import { posthog } from '~/toolbar/posthog'
and capture via that.
I'm not sure if posthog-js
would work now or not, but the original issue (and the reason for writing posthog-js-lite
in the first place) was that I could not easily include two copies of posthog-js
on a page at the same time. The toolbar is always running on a site that already has a copy of posthog-js
running and sending events for the client. We need to be careful not to send the "toolbar button clicked" events to the client, but to ourselves.
I'll see what can be done regarding the other questions...
I updated the posthog library to the right one, fixed some type errors and added information about the action and heatmap counts. It's probably OK to merge now, but please test :) |
Thanks for the review and suggestions, made some additional changes. Looks good to merge to me, but feel free to review once more before merging (will merge tomorrow otherwise). Also worth noting, noticed that we don't self-capture toolbar events in development, but keeping that for a separate PR. |
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.
Looks good!
Changes
Introduces basic instrumentation to the toolbar.
toolbar mode triggered
event which is fired when any of the toolbar modes (heatmap, inspect, stats, ...) are activated/deactivated.toolbar selected HTML element
event which is fired when an element in the host's website is clicked for further details.toolbar dragged
event which is fired after the toolbar has been dragged and is dropped somewhere in the screen.toolbar loaded
event which is fired when the toolbar component is loaded.Checklist