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

Add event tracking with PostHog #1482

Merged

Conversation

rafaellehmkuhl
Copy link
Member

This patch adds tracking of specific events to the PostHog platform.
It will help us better understand user behavior and how to improve the app.

For now, the following events are tracked:

  • App start
  • Session time
  • Video recording start/stop
  • Video recording time
  • Vehicle arming/disarming

More events should be tracked in the future.
User-data is anonymized by default.

@ArturoManzoli
Copy link
Contributor

Wow, this opens a lot of possibilities! Great feature to have.
Have you noticed any Cockpit performance changes when enabling this logs?

Library used for event tracking.
@rafaellehmkuhl
Copy link
Member Author

rafaellehmkuhl commented Dec 6, 2024

Wow, this opens a lot of possibilities! Great feature to have. Have you noticed any Cockpit performance changes when enabling this logs?

It does indeed!

No performance changes, but I remembered I didn't check how well it behaves when the application is offline, and if the events are cached for the next session, like in Sentry. Will do some tests and if everything goes right I will merge it.

EDIT: from my tests the events are lost if the application is closed before going online. I've opened an issue in their library repo to discuss that. In the meantime I will implement the persistence on our side.

For now, the following are tracked:
- App start
- Session time
- Video recording start/stop
- Video recording time
- Vehicle arming/disarming
…at persists between sessions

This way, if the user uses the application while offline and close it, without ever being online in that session, we still preserve the events and send them when possible in a following online usage.
@rafaellehmkuhl rafaellehmkuhl marked this pull request as ready for review December 9, 2024 12:17
@rafaellehmkuhl
Copy link
Member Author

rafaellehmkuhl commented Dec 9, 2024

@ArturoManzoli I've added a dedicated IndexedDB-based queue, that supports offline events. Could you check if they work for you?

You basically want to test if, while offline, some event captures fail (in the network tab) and are cached in the dedicated IndexedDB (application tab), if they are still there when you reopen Cockpit and if their network calls are correctly sent when you reopen Cockpit again while online.

@ArturoManzoli ArturoManzoli merged commit e28a6ef into bluerobotics:master Dec 9, 2024
10 checks passed
@rafaellehmkuhl rafaellehmkuhl deleted the add-event-tracking branch December 9, 2024 15:01
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.

2 participants