-
Notifications
You must be signed in to change notification settings - Fork 1
Add web analytics documentation #351
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
base: main
Are you sure you want to change the base?
Conversation
- Create web-analytics.mdx in Services/Observability covering: - Automatic page view tracking features - Configuration options - Custom event tracking (data attributes and JS API) - React integration (useAnalytics, useTrackOnMount, withPageTracking) - Privacy considerations - Update Observability meta.json to include web-analytics - Add Analytics Hooks section to Frontend/react-hooks.mdx with link to main docs Co-Authored-By: Rick Blalock <rickblalock@mac.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
📝 WalkthroughWalkthroughAdds a new web analytics documentation file describing features, configuration, and React integration. Updates the Observability meta.json to include web-analytics in the pages list. Adds Analytics Hooks documentation to react-hooks.mdx, with duplicated content sections. Changes
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@content/Services/Observability/web-analytics.mdx`:
- Around line 50-61: Update the web-analytics docs table to match the
AnalyticsConfig interface by adding the missing boolean options
trackOutboundLinks (default true) and trackForms (default true), and change the
type of globalProperties from generic object to Record<string, unknown>; ensure
the table row names match the existing option names (e.g., trackClicks,
trackScroll, trackWebVitals, trackErrors, trackSPANavigation, sampleRate,
excludePatterns) so the doc and the AnalyticsConfig symbol stay in sync.
🧹 Nitpick comments (1)
content/Services/Observability/web-analytics.mdx (1)
34-47: Configuration example missingrequireConsentoption.The JSON example omits
requireConsent, which is documented in the options table below (line 53). For completeness, consider adding it to the example.📝 Suggested addition
{ "analytics": { "enabled": true, + "requireConsent": false, "trackClicks": true, "trackScroll": true,
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
content/Frontend/react-hooks.mdxcontent/Services/Observability/meta.jsoncontent/Services/Observability/web-analytics.mdx
🔇 Additional comments (4)
content/Frontend/react-hooks.mdx (2)
319-341: LGTM!Clean and concise Analytics Hooks section with a practical example. The code snippet effectively demonstrates both
useAnalyticsanduseTrackOnMounthooks, and appropriately links to the full documentation for readers who need more detail.
348-348: LGTM!Appropriate addition to Next Steps, providing discoverability for the new analytics documentation.
content/Services/Observability/web-analytics.mdx (1)
1-220: LGTM! Comprehensive and well-structured documentation.The documentation thoroughly covers automatic tracking, configuration, custom events, React integration, and privacy considerations. The code examples are clear and the cross-links to related documentation (logging, tracing, react-hooks) are appropriate.
content/Services/Observability/meta.json (1)
3-3: LGTM!Correctly adds the new web-analytics page to the Observability section navigation.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| | Option | Type | Default | Description | | ||
| |--------|------|---------|-------------| | ||
| | `enabled` | `boolean` | `true` | Enable or disable analytics | | ||
| | `requireConsent` | `boolean` | `false` | Require user consent before tracking | | ||
| | `trackClicks` | `boolean` | `true` | Track clicks on elements with `data-analytics` attribute | | ||
| | `trackScroll` | `boolean` | `true` | Track scroll depth milestones | | ||
| | `trackWebVitals` | `boolean` | `true` | Track Core Web Vitals metrics | | ||
| | `trackErrors` | `boolean` | `true` | Track JavaScript errors | | ||
| | `trackSPANavigation` | `boolean` | `true` | Track SPA route changes | | ||
| | `sampleRate` | `number` | `1` | Sample rate from 0 to 1 (1 = 100% of page views) | | ||
| | `excludePatterns` | `string[]` | `[]` | URL patterns to exclude from tracking | | ||
| | `globalProperties` | `object` | `{}` | Properties added to all events | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for AnalyticsConfig interface definition
echo "=== Searching for AnalyticsConfig interface ==="
find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) ! -path "*/node_modules/*" ! -path "*/.next/*" ! -path "*/dist/*" -exec grep -l "AnalyticsConfig" {} \;
echo ""
echo "=== Searching with ast-grep for interface definition ==="
ast-grep --pattern 'interface AnalyticsConfig { $$$ }' 2>/dev/null || true
echo ""
echo "=== Searching with rg for AnalyticsConfig ==="
rg -n -B2 -A 20 'interface AnalyticsConfig|type AnalyticsConfig' --type ts --type tsx 2>/dev/null | head -100
echo ""
echo "=== Listing repository structure to understand codebase ==="
git ls-files | grep -E '(analytics|sdk|config)' | head -30Repository: agentuity/docs
Length of output: 2098
Add missing configuration options and fix type precision.
The documentation table is incomplete. The AnalyticsConfig interface includes two additional options not listed: trackOutboundLinks (boolean, default true) and trackForms (boolean, default true). Additionally, the globalProperties type should be Record<string, unknown> rather than generic object for clarity.
Complete configuration table
| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
true |
Enable or disable analytics |
requireConsent |
boolean |
false |
Require user consent before tracking |
trackClicks |
boolean |
true |
Track clicks on elements with data-analytics attribute |
trackScroll |
boolean |
true |
Track scroll depth milestones |
trackOutboundLinks |
boolean |
true |
Track outbound link clicks |
trackForms |
boolean |
true |
Track form submissions |
trackWebVitals |
boolean |
true |
Track Core Web Vitals metrics |
trackErrors |
boolean |
true |
Track JavaScript errors |
trackSPANavigation |
boolean |
true |
Track SPA route changes |
sampleRate |
number |
1 |
Sample rate from 0 to 1 (1 = 100% of page views) |
excludePatterns |
string[] |
[] |
URL patterns to exclude from tracking |
globalProperties |
Record<string, unknown> |
{} |
Properties added to all events |
🤖 Prompt for AI Agents
In `@content/Services/Observability/web-analytics.mdx` around lines 50 - 61,
Update the web-analytics docs table to match the AnalyticsConfig interface by
adding the missing boolean options trackOutboundLinks (default true) and
trackForms (default true), and change the type of globalProperties from generic
object to Record<string, unknown>; ensure the table row names match the existing
option names (e.g., trackClicks, trackScroll, trackWebVitals, trackErrors,
trackSPANavigation, sampleRate, excludePatterns) so the doc and the
AnalyticsConfig symbol stay in sync.
Summary
Adds documentation for the web/frontend analytics SDK feature, which was previously undocumented. The documentation is placed under Services/Observability (as suggested by Rick) with a reference added to the Frontend/react-hooks page.
Changes:
web-analytics.mdxpage covering automatic tracking, configuration, custom events, React hooks, and privacymeta.jsonto include the new page in navigationreact-hooks.mdxwith a brief example and link to the main docsReview & Testing Checklist for Human
agentuity.jsonconfiguration format is correct - I inferred this from the SDK'swebanalytics-generator.tsbut didn't find explicit documentationAnalyticsConfiginterface in the SDKnpm run dev) and verify the new page renders correctly at/Services/Observability/web-analyticsSuggested test: Navigate to the new page in the docs site preview and verify the content displays properly with correct formatting for code blocks and tables.
Notes
packages/frontend/src/analytics/andpackages/react/src/analytics.tsxLink to Devin run: https://app.devin.ai/sessions/8572707ba4ad4d03baceec6499aa95c7
Requested by: Rick Blalock (@rblalock)
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.