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 up telemetry service #125

Merged
merged 4 commits into from
Aug 28, 2020
Merged

Set up telemetry service #125

merged 4 commits into from
Aug 28, 2020

Conversation

tjsilver
Copy link
Contributor

@tjsilver tjsilver commented Aug 27, 2020

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:

  • Checking document
  • Using 'close' button
  • Clicking on a sidebar match
  • Accepting a suggestion
  • Marking a match as correct.

@tjsilver tjsilver changed the title Ts/telemetry service Set up telemetry service Aug 27, 2020
@tjsilver tjsilver requested review from jonathonherbert and a team August 27, 2020 16:51
Comment on lines +75 to +77
const stubTelemetrySender = (event: ITyperighterTelemetryEvent) =>
console.log(event);
const telemetryService = new TelemetryService(stubTelemetrySender);
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 here for testing.

@@ -85,10 +88,18 @@ const Controls = ({
const handleCheckDocumentButtonClick = (): void => {
if (!pluginIsActive) {
onToggleActiveState();
telemetryService?.typerighterIsOpened({documentUrl: document.URL})
Copy link
Contributor

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.

Copy link
Contributor

@jonathonherbert jonathonherbert left a 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!)

@tjsilver tjsilver merged commit 05d366f into master Aug 28, 2020
@jonathonherbert jonathonherbert deleted the ts/telemetry-service branch September 7, 2020 07:16
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.

None yet

2 participants