Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Feb 1, 2026

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:

  • New web-analytics.mdx page covering automatic tracking, configuration, custom events, React hooks, and privacy
  • Updated Observability meta.json to include the new page in navigation
  • Added "Analytics Hooks" section to react-hooks.mdx with a brief example and link to the main docs

Review & Testing Checklist for Human

  • Verify the agentuity.json configuration format is correct - I inferred this from the SDK's webanalytics-generator.ts but didn't find explicit documentation
  • Confirm the configuration options table matches the actual AnalyticsConfig interface in the SDK
  • Run the docs site locally (npm run dev) and verify the new page renders correctly at /Services/Observability/web-analytics
  • Check that all internal links work (to logging, tracing, react-hooks pages)

Suggested 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

  • The lint check showed pre-existing errors in other files (scripts/, app/chat/, etc.) unrelated to these documentation changes
  • Documentation was written based on reviewing the SDK implementation in packages/frontend/src/analytics/ and packages/react/src/analytics.tsx

Link to Devin run: https://app.devin.ai/sessions/8572707ba4ad4d03baceec6499aa95c7
Requested by: Rick Blalock (@rblalock)

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive web analytics documentation, covering configuration, custom event tracking, and privacy options.
    • Added Analytics Hooks documentation for React, including integration examples and SPA navigation tracking guidance.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Web Analytics Documentation
content/Services/Observability/web-analytics.mdx
Introduces comprehensive web analytics documentation including feature descriptions, configuration options, custom event tracking, React integration (useAnalytics, useTrackOnMount, withPageTracking), SPA navigation tracking, privacy considerations, and opt-out mechanisms with example code snippets.
React Hooks Documentation
content/Frontend/react-hooks.mdx
Adds Analytics Hooks documentation section demonstrating useAnalytics and useTrackOnMount with a sample ProductPage component and Web Analytics link. Note: Analytics Hooks block appears duplicated within the file.
Observability Configuration
content/Services/Observability/meta.json
Updates pages list to include "web-analytics" reference alongside existing logging, tracing, and sessions-debugging entries.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 missing requireConsent option.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e21a167 and da89c0a.

📒 Files selected for processing (3)
  • content/Frontend/react-hooks.mdx
  • content/Services/Observability/meta.json
  • content/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 useAnalytics and useTrackOnMount hooks, 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.

Comment on lines +50 to +61
| 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 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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 -30

Repository: 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.

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.

1 participant