Wp-calypso: Nav sidebar: add analytics

Created on 13 Aug 2020  路  6Comments  路  Source: Automattic/wp-calypso

Events to track:

  1. When the sidebar is opened
  2. When the user goes back to the dashboard
  3. When the user navigates to a new post/page
  4. When the user clicks on "add a new post/page"

Request from: p1597310072473200-slack-CRWCHQGUB

Analytics [Goal] Editor Improvements [Type] Enhancement

All 6 comments

Also looks like we can use recordTracksEvent pulled from @automattic/calypso-analytics, which is used here: https://github.com/automattic/wp-calypso/blob/HEAD/apps/editing-toolkit/editing-toolkit-plugin/editor-gutenboarding-launch/index.ts#L8, which might be a bit easier.

Also looks like we can use recordTracksEvent pulled from @automattic/calypso-analytics

Nice! Totally missed that.

Also looks like we can use recordTracksEvent pulled from @automattic/calypso-analytics, which is used here: https://github.com/automattic/wp-calypso/blob/HEAD/apps/editing-toolkit/editing-toolkit-plugin/editor-gutenboarding-launch/index.ts#L8, which might be a bit easier.

In the calypso-analytics readme it says:

In most situations it is best to use the Analytics Middleware, which has no direct browser dependencies and therefore will not complicate any unit testing of the modules where it is used.

I don't have the context yet to judge if it is better to use the middleware approach. Any thoughts?

I don't have the context yet to judge if it is better to use the middleware approach. Any thoughts?

I think it's okay to ignore that advice when we're using the tracking methods in the Editing Toolkit. The middleware doesn't exist in that app, and I don't think we're going to patch it in.

You're pretty safe following the examples from https://github.com/automattic/wp-calypso/blob/HEAD/apps/editing-toolkit/editing-toolkit-plugin/editor-gutenboarding-launch/index.ts#L8 and https://github.com/automattic/wp-calypso/blob/HEAD/apps/editing-toolkit/editing-toolkit-plugin/editor-gutenboarding-launch/index.ts#L76 I reckon.

You can go ahead and implement what you think is right, then we can 馃憖 at it and worry about tracking event property names and so on in the PR review comments.

Was this page helpful?
0 / 5 - 0 ratings