SDK Analytics Installer
Use this skill when the user asks to install, configure, or set up @dotcms/analytics, sdk-analytics, analytics SDK, add analytics tracking, or mentions installing analytics in Next.js or React projects
Security Assessment
Detected risks:
About SDK Analytics Installer
The SDK Analytics Installer skill provides developers with guided instructions for installing and configuring the `@dotcms/analytics` SDK in Next.js or React projects. It addresses the common challenge of implementing content-aware analytics tracking without requiring users to manually handle low-level configuration details. By using this skill, developers can quickly integrate the dotCMS analytics SDK into their projects, ensuring consistent tracking of user interactions, page views, and custom events across the application. This streamlines the setup process and minimizes errors associated with manual configuration, particularly in complex component structures where multiple hooks and components may need access to analytics functions.
The skill enables several core capabilities of the SDK, including automatic page view tracking, conversion tracking for purchases or sign-ups, custom event tracking, session management with a 30-minute timeout, anonymous user identity tracking, UTM campaign parameter tracking, and event batching for improved performance. It emphasizes best practices such as centralizing configuration in a single file to maintain consistency across components and simplify updates. Additionally, it provides clear guidance on the correct usage patterns for the `<DotContentAnalytics />` component and the `useContentAnalytics(config)` hook, highlighting that configuration must always be explicitly passed to the hook.
Target users for this skill are front-end developers working in React or Next.js environments who need to implement analytics tracking in dotCMS-powered projects. It is particularly useful for teams who want to standardize analytics implementation across multiple components, reduce configuration duplication, and ensure accurate event tracking. Common use cases include setting up analytics in marketing pages, e-commerce flows, content-heavy applications, and any scenario where measuring user engagement and conversions is critical. This skill also serves as a reference for developers seeking to understand the SDK's component roles and recommended installation patterns.
FAQ
Do I need to pass a config to `useContentAnalytics()` every time I use it?
Yes, the hook always requires a config parameter. It does not use React Context, so each component must import and pass the centralized config explicitly.
Can I track pageviews automatically without using the hook?
Yes, placing the `<DotContentAnalytics />` component in the root layout enables automatic pageview tracking on route changes.
Is this SDK compatible with both Next.js and React projects?
Yes, the instructions and components provided by this skill are intended for use in both Next.js and standard React environments.
Why should I centralize the analytics configuration?
Centralizing the config prevents duplication, ensures consistent values across components, and simplifies updating environment variables or SDK settings.
Are there any limitations to automatic event tracking?
Automatic pageview tracking is limited to the `<DotContentAnalytics />` component and does not provide config to child components. Custom events still require using the `useContentAnalytics(config)` hook.
Install SDK Analytics Installer
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
Microck/ordinary-claude-skills