[PR #3838] [MERGED] feat: SH instance analytics data collection #4548

Closed
opened 2026-03-17 02:04:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3838
Author: @balub
Created: 2/16/2024
Status: Merged
Merged: 2/21/2024
Merged by: @AndrewBastin

Base: release/2024.3.0Head: feat/sh-analytics-collection


📝 Commits (10+)

  • d6b6958 chore: installed required packages
  • a99a21e feat: added analytics related infra-configs
  • 6170de9 chore: create new posthog module
  • e685235 feat: added method to capture events in posthog module
  • 109eb33 feat: added new mutation to toggle analytics collection infra-config
  • a74195d chore: made the cronjob run dynamically to collect analytics
  • 272d7a2 chore: removed Cron decorator from capture method in posthog service file
  • af5e33e chore: removed unnecessary comments
  • 6fa995b chore: changed cronjob duration to every week
  • 6b43694 chore: set analytics collection to false by default

📊 Changes

10 files changed (+10025 additions, -4029 deletions)

View changed files

📝 packages/hoppscotch-backend/package.json (+3 -0)
📝 packages/hoppscotch-backend/src/admin/infra.resolver.ts (+20 -0)
📝 packages/hoppscotch-backend/src/app.module.ts (+4 -0)
📝 packages/hoppscotch-backend/src/errors.ts (+6 -0)
📝 packages/hoppscotch-backend/src/infra-config/helper.ts (+10 -0)
📝 packages/hoppscotch-backend/src/infra-config/infra-config.service.ts (+30 -1)
packages/hoppscotch-backend/src/posthog/posthog.module.ts (+9 -0)
packages/hoppscotch-backend/src/posthog/posthog.service.ts (+58 -0)
📝 packages/hoppscotch-backend/src/types/InfraConfig.ts (+3 -0)
📝 pnpm-lock.yaml (+9882 -4028)

📄 Description

Closes HSB-363

Description

In this PR we allow basic analytics to be collected from the hosted SH instance and sent to PostHog. Analytics collection is enabled by default and admins can chose to disable it from the admin dashboard which uses a new mutation to toggle data collection by the instance.

mutation {
  toggleAnalyticsCollection(status: ENABLE)
}

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/3838 **Author:** [@balub](https://github.com/balub) **Created:** 2/16/2024 **Status:** ✅ Merged **Merged:** 2/21/2024 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2024.3.0` ← **Head:** `feat/sh-analytics-collection` --- ### 📝 Commits (10+) - [`d6b6958`](https://github.com/hoppscotch/hoppscotch/commit/d6b6958dd7303b082a6472713cb4a1b4cfa2bc66) chore: installed required packages - [`a99a21e`](https://github.com/hoppscotch/hoppscotch/commit/a99a21ed3979bb5242de9ff514a84e5a104bb389) feat: added analytics related infra-configs - [`6170de9`](https://github.com/hoppscotch/hoppscotch/commit/6170de90f09dc0bbdb3abb13112cfb205f40cb33) chore: create new posthog module - [`e685235`](https://github.com/hoppscotch/hoppscotch/commit/e685235c9b02baa4086427c6e9fc3eb5a6eab785) feat: added method to capture events in posthog module - [`109eb33`](https://github.com/hoppscotch/hoppscotch/commit/109eb337f16664723ae728066bd3473d16e52fd7) feat: added new mutation to toggle analytics collection infra-config - [`a74195d`](https://github.com/hoppscotch/hoppscotch/commit/a74195db554d1a8427d32fdab935e647ca23a790) chore: made the cronjob run dynamically to collect analytics - [`272d7a2`](https://github.com/hoppscotch/hoppscotch/commit/272d7a28eb4381775bd18dccb39e20b1333a300c) chore: removed Cron decorator from capture method in posthog service file - [`af5e33e`](https://github.com/hoppscotch/hoppscotch/commit/af5e33ee266e4841e31f199a43c88da94ce9e0f5) chore: removed unnecessary comments - [`6fa995b`](https://github.com/hoppscotch/hoppscotch/commit/6fa995b35b25b9a0be4bd81065118a166e4a3db6) chore: changed cronjob duration to every week - [`6b43694`](https://github.com/hoppscotch/hoppscotch/commit/6b43694b17e64c10b7c60ccd712e9012848e04f5) chore: set analytics collection to false by default ### 📊 Changes **10 files changed** (+10025 additions, -4029 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-backend/package.json` (+3 -0) 📝 `packages/hoppscotch-backend/src/admin/infra.resolver.ts` (+20 -0) 📝 `packages/hoppscotch-backend/src/app.module.ts` (+4 -0) 📝 `packages/hoppscotch-backend/src/errors.ts` (+6 -0) 📝 `packages/hoppscotch-backend/src/infra-config/helper.ts` (+10 -0) 📝 `packages/hoppscotch-backend/src/infra-config/infra-config.service.ts` (+30 -1) ➕ `packages/hoppscotch-backend/src/posthog/posthog.module.ts` (+9 -0) ➕ `packages/hoppscotch-backend/src/posthog/posthog.service.ts` (+58 -0) 📝 `packages/hoppscotch-backend/src/types/InfraConfig.ts` (+3 -0) 📝 `pnpm-lock.yaml` (+9882 -4028) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes HSB-363 ### Description <!-- Add a brief description of the pull request --> In this PR we allow basic analytics to be collected from the hosted SH instance and sent to PostHog. Analytics collection is enabled by default and admins can chose to disable it from the admin dashboard which uses a new mutation to toggle data collection by the instance. ``` mutation { toggleAnalyticsCollection(status: ENABLE) } ``` <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [x] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed ### Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:04:29 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4548
No description provided.