-
Notifications
You must be signed in to change notification settings - Fork 5
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 up telemetry service #125
Conversation
Co-authored-by: Jonathon Herbert <jonathon.herbert@guardian.co.uk>
const stubTelemetrySender = (event: ITyperighterTelemetryEvent) => | ||
console.log(event); | ||
const telemetryService = new TelemetryService(stubTelemetrySender); |
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 here for testing.
@@ -85,10 +88,18 @@ const Controls = ({ | |||
const handleCheckDocumentButtonClick = (): void => { | |||
if (!pluginIsActive) { | |||
onToggleActiveState(); | |||
telemetryService?.typerighterIsOpened({documentUrl: document.URL}) |
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 the perfect use-case for optional chaining – love to see it.
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.
Code looks great, works as expected – great to see those very official looking events in the console (for now!)
What does this change?
We will have an analytics client shortly, responsible for batching and submitting telemetry events. We'd like our Prosemirror plugin to send events when they occur, via that interface.
This PR implements an events service with prosemirror-typerighter that calls the appropriate code when events happen. The backend of the implementation logs to console for now.
How to test
Run the branch locally and check the console for details of events triggered. You should see a separate log entry for: