segment-cdp
Segment CDP Integration Patterns
Integrate Segment Customer Data Platform with Claude Code to implement client-side and server-side tracking, design tracking plans, and manage data governance across your application.
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「segment-cdp」。 Show me how to implement basic page and track calls using Analytics.js
預期結果:
Analytics.js provides client-side tracking through the analytics object. Initialize with your write key, then use analytics.page() for page views and analytics.track() for custom events.
Example initialization:
analytics.load({ writeKey: 'YOUR_WRITE_KEY' });
Page view:
analytics.page();
Track event:
analytics.track('Button Click', {
button_id: 'signup_cta',
button_text: 'Sign Up Now'
});
正在使用「segment-cdp」。 Create a Node.js function for server-side event tracking
預期結果:
Use the @segment/analytics-node library for server-side tracking. Import Analytics, instantiate with your write key, then call track() with the event details.
const Analytics = require('@segment/analytics-node');
const analytics = new Analytics({ writeKey: 'YOUR_WRITE_KEY' });
analytics.track({
userId: 'user_123',
event: 'Order Completed',
properties: {
order_id: 'order_456',
total: 99.99,
currency: 'USD'
}
});
安全審計
安全This skill contains only documentation patterns for Segment CDP integration. Static analysis flagged 'DES' within the word 'Design' as a weak cryptographic algorithm - this is a false positive. No executable code with cryptographic operations exists. The skill is safe for publication.
高風險問題 (1)
品質評分
你能建構什麼
E-commerce Tracking Setup
Implement comprehensive event tracking for an e-commerce platform including product views, cart updates, and checkout flows using Analytics.js
Server-Side Event Collection
Set up secure server-side tracking for sensitive backend events like webhook processing and API calls using analytics-node
Tracking Plan Governance
Design and enforce tracking plan schemas to ensure data quality and consistency across multiple teams and data sources
試試這些提示
Show me how to implement basic page and track calls using Analytics.js for a new web application
Create a Node.js function that sends server-side events to Segment using the analytics-node library
Design a tracking plan schema for a SaaS subscription event including required properties, types, and validation rules
Explain how to implement user identification and anonymous ID merging in Analytics.js
最佳實務
- Use consistent Object + Action naming convention for events (e.g., 'Order Completed', 'Product Viewed')
- Call analytics.identify() before track() calls to associate events with user data
- Include required properties in tracking plan and validate with Segment Protocols
避免
- Using dynamic event names constructed from user input - event names should be predefined
- Tracking properties as events instead of using properties within events
- Missing identify call before track - always identify users first for proper attribution