segment-cdp
Expert patterns for Segment Customer Data Platform including Analytics.js, server-side tracking, tracking plans with Protocols, identity resolution, destinations configuration, and data governance best practices.
npx skills add sickn33/agentic-awesome-skills --skill segment-cdp --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Provides Expert patterns for Segment CDP usage including browser analytics, server-side tracking, tracking plans with Protocols, identity resolution, destinations configuration, and data governance practices.
How it works
- Analytics.js Browser Integration: demonstrates client-side tracking with Analytics.js, including identify, track, page, and group calls. Includes a Next.js example with an AnalyticsBrowser instance, typed UserTraits, and helper functions identify, track, page, group. Provides a React hook usePageTracking that records page views on route changes and example usages in components (PricingButton) and auth flow (onUserLogin).
- Context: browser tracking, website analytics, client-side events.
- Server-Side Tracking with Node.js: shows server-side tracking using @segment/analytics-node with batched flushing, and typed ServerContext. Exposes serverIdentify, serverTrack, and closeAnalytics. Includes usage in API routes (example for Stripe webhooks) and a graceful shutdown handler.
- Context: server-side tracking, backend events, webhook processing.
- Tracking Plan Design: outlines event schemas and Protocols integration using a conceptual YAML-like structure, with identify traits and events like User Signed Up, Product Viewed, Order Completed. Includes a TypeScript implementation for type-safe tracking via TrackingEvents and trackEvent, plus usage example.
- Context: tracking plan, data governance, event schema.
- Identity Resolution: explains tracking anonymous users, merging with identified users, and using alias for identity merging. Provides identity flow code with trackAnonymousAction, identifyUser, associateWithCompany, linkIdentities, and a full signup flow handleSignup.
- Context: user identification, anonymous tracking, B2B tracking.
- Destinations Configuration: describes routing data to various destinations, enabling/disabling integrations per destination, and a sample trackWithDestinations function with a focused trackRevenue example and identifyWithPII to restrict PII to trusted destinations.
- Context: data routing, destination setup, tool integration.
- HTTP Tracking API: direct HTTP API for environments like edge functions, with Batch support and an HTTP API surface via httpIdentify, httpTrack, httpPage, and httpBatch.
When to use it
Use when you need a comprehensive, pattern-based implementation of Segment CDP across client and server environments, including identity resolution, governance, and flexible destination routing. Trigger usage in projects requiring typed, end-to-end Segment integration and clear patterns for events, traits, and context.
What it can touch
- Client-side analytics via Analytics.js (Browser)
- Server-side analytics via @segment/analytics-node (Server)
- HTTP API endpoints for identify/track/page/batch via httpIdentify, httpTrack, httpPage, httpBatch
- Destination integrations configuration within tracking calls (trackWithDestinations, trackRevenue, identifyWithPII, enrichedTrack)
- Type-safe event definitions (TrackingEvents) and helper functions (trackEvent)
Caveats
- License: MIT
- Risk: safe
- No explicit outcomes promised; examples show usage patterns and code scaffolds only.
# Segment CDP Expert patterns for Segment Customer Data Platform including Analytics.js, server-side tracking, tracking plans with Protocols, identity resolution, destinations configuration, and data governance best practices. ## Patterns ### Analytics.js Browser Integration Client-side tracking with Analytics.js. Include track, identify, page, and group calls. Anonymous ID persists until identify merges with user. // Next.js - Analytics provider component // lib/segment.ts import { AnalyticsBrowser } from '@segment/analytics-next'; export const analytics = AnalyticsBrowser.load({ writeKey: process.env.NEXT_PUBLIC_SEGMENT_WRITE_KEY!, }); // Typed event helpers export interface UserTraits { email?: string; name?: string; plan?: 'free' | 'pro' | 'enterprise'; createdAt?: string; company?: { id: string; name: string; }; } export function identify(userId: string, traits?: UserTraits) { analytics.identify(userId, traits); } export function track<T extends Record<string, any>>( event: string, properties?: T ) { analytics.track(event, properties); } export function page(name?: string, properties?: Record<string, any>) { analytics.page(name, properties); } export function group(groupId: st
- Patterns
- Analytics.js Browser Integration
- Context
- Server-Side Tracking with Node.js
- Tracking Plan Design
- Identity Resolution
- Destinations Configuration
- HTTP Tracking API
- Sharp Edges
- Anonymous ID Persists Until Explicit Reset
- Device Mode Bypasses Protocols Blocking
- HTTP API Has Strict Size Limits
- Track Calls Without Identify Are Anonymous
- Write Key in Client is Visible (But Intentional)
What does the segment-cdp skill do?
Expert patterns for Segment Customer Data Platform including Analytics.js, server-side tracking, tracking plans with Protocols, identity resolution, destinations configuration, and data governance best practices.
How do I install it?
Run `npx skills add sickn33/agentic-awesome-skills --skill segment-cdp --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From sickn33/agentic-awesome-skills, a repository with 44,414 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.