Implement PostHog Analytics for API Request Insights #2230
+746
−186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request integrates PostHog analytics into the Stirling-PDF application to track file upload sizes, PDF page counts, and processing times for API requests. The goal of this enhancement is to gain valuable insights into how users interact with our application, specifically the types and sizes of files they are working with, and the efficiency of our processing times.
By capturing this data, we can better understand user behavior, identify potential performance bottlenecks, and tailor our services to meet the needs of our user base more effectively. This feature is particularly valuable as it will help us optimize the application for the most common use cases and improve the overall user experience.
Why is this feature valuable?
User Behavior Analysis: Tracking file upload sizes and PDF page counts will provide us with insights into the types of documents our users are handling. This information can guide future feature development and resource allocation.
Performance Monitoring: Capturing processing times will allow us to monitor the performance of our API requests and identify areas for improvement, ensuring that our application remains fast and responsive.
Product Improvement: Understanding how users engage with Stirling-PDF will help us uncover opportunities for product enhancement, allowing us to continuously improve and adapt to user needs.
Resource Planning: Analyzing the data can aid in resource planning, such as server capacity and bandwidth requirements, to support user growth and business expansion.
Closes #2194
Checklist
Implementation Details
PostHog Integration: The PostHog SDK has been integrated into the application to capture and send analytics data.
Data Capture: The application now captures file upload sizes, PDF page counts, and processing times for each API request.
Data Privacy: The analytics data captured does not include any personally identifiable information (PII), ensuring user privacy.
Additional Notes
The implementation has been tested to ensure accurate data capture and transmission to PostHog.
Documentation has been updated to include information on the analytics data being captured and how it can be accessed.