segment
顧客データを収集・整理し、様々なツールへ連携できるSegmentを活用し、ユーザー行動の追跡や分析ツールの一元化、データ送信などを実現するSkill。
📜 元の英語説明(参考)
Collect and route customer data with Segment — customer data platform (CDP) that sends events to any destination. Use when someone asks to "track user events across tools", "Segment", "customer data platform", "send events to multiple analytics tools", "CDP", or "unify analytics across Mixpanel/ Amplitude/BigQuery". Covers identify, track, page, group, and destination routing.
🇯🇵 日本人クリエイター向け解説
顧客データを収集・整理し、様々なツールへ連携できるSegmentを活用し、ユーザー行動の追跡や分析ツールの一元化、データ送信などを実現するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o segment.zip https://jpskill.com/download/15368.zip && unzip -o segment.zip && rm segment.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15368.zip -OutFile "$d\segment.zip"; Expand-Archive "$d\segment.zip" -DestinationPath $d -Force; ri "$d\segment.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
segment.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
segmentフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Segment
概要
Segment は顧客データプラットフォームです。イベントを一度収集し、スタック内のすべてのツールにルーティングします。Mixpanel、Amplitude、Google Analytics、Intercom、BigQuery 用の SDK を個別に追加する代わりに(それぞれ独自のトラッキングコードを使用)、イベントを Segment に送信すると、Segment がすべての送信先に転送します。1 つの API、1 つのイベントスキーマ、400 以上の連携機能があります。コードを変更せずに送信先のオン/オフを切り替えることができます。
使用する場面
- 分析イベントを複数のツール(Mixpanel + BigQuery + Intercom)に送信する場合
- ツールを切り替える際にトラッキング SDK を追加/削除したくない場合
- 顧客イベントの信頼できる唯一の情報源が必要な場合
- Web + モバイル + サーバー側のイベントトラッキングを統合する場合
- データウェアハウスのパイプラインを構築する場合(events → BigQuery/Snowflake)
手順
セットアップ
# Browser (Analytics.js)
# サイトに追加:
<script>
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];analytics.factory=function(e){return function(){if(window.analytics.initialized)return window.analytics[e].apply(window.analytics,arguments);var i=Array.prototype.slice.call(arguments);if(["track","screen","alias","group","page","identify"].indexOf(e)>-1){var c=document.querySelector("link[rel='canonical']");i.push({__t:"bpc",c:c&&c.getAttribute("href")||void 0,p:location.pathname,u:location.href,s:location.search,t:document.title,r:document.referrer})}i.unshift(e);analytics.push(i);return analytics}};for(var i=0;i<analytics.methods.length;i++){var key=analytics.methods[i];analytics[key]=analytics.factory(key)}analytics.load=function(key,i){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.setAttribute("data-global-segment-analytics-key","analytics");t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=i};analytics._writeKey="YOUR_WRITE_KEY";analytics.SNIPPET_VERSION="5.2.1";analytics.load("YOUR_WRITE_KEY");analytics.page();}}();
</script>
# Node.js
npm install @segment/analytics-node
コア API 呼び出し
// tracking.ts — 5 つの Segment API 呼び出し
import { Analytics } from "@segment/analytics-node";
const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY! });
// 1. IDENTIFY — ユーザーは誰ですか?
analytics.identify({
userId: "user_123",
traits: {
email: "kai@example.com",
name: "Kai",
plan: "pro",
company: "Acme",
createdAt: "2026-01-15T00:00:00Z",
},
});
// 2. TRACK — 何をしましたか?
analytics.track({
userId: "user_123",
event: "Order Completed",
properties: {
orderId: "ord_456",
total: 99.99,
currency: "USD",
products: [
{ id: "prod_1", name: "Widget", price: 49.99, quantity: 2 },
],
},
});
// 3. PAGE — どのページにいますか? (ブラウザ側)
analytics.page({
userId: "user_123",
name: "Pricing",
properties: { url: "https://myapp.com/pricing", referrer: "https://google.com" },
});
// 4. GROUP — どの会社/チームに所属していますか?
analytics.group({
userId: "user_123",
groupId: "company_789",
traits: { name: "Acme Corp", industry: "Technology", employees: 50, plan: "enterprise" },
});
// 5. ALIAS — 匿名ユーザーを既知のユーザーにリンクする (サインアップ時)
analytics.alias({ userId: "user_123", previousId: "anon_abc" });
React 連携
// hooks/useTracking.ts — Segment トラッキング用の React フック
export function useTracking() {
const track = (event: string, properties?: Record<string, any>) => {
window.analytics?.track(event, properties);
};
const identify = (userId: string, traits?: Record<string, any>) => {
window.analytics?.identify(userId, traits);
};
const page = (name?: string, properties?: Record<string, any>) => {
window.analytics?.page(name, properties);
};
return { track, identify, page };
}
// 使用例
function PricingPage() {
const { track, page } = useTracking();
useEffect(() => { page("Pricing"); }, []);
return (
<button onClick={() => track("Plan Selected", { plan: "pro", price: 49 })}>
Choose Pro
</button>
);
}
例
例 1: SaaS 製品のトラッキングを設定する
ユーザープロンプト: 「ユーザーのサインアップ、機能の使用状況、購入を追跡し、Mixpanel、BigQuery、Intercom に送信します。」
エージェントは、サインアップ時に identify を使用して Segment を設定し、主要なアクションの track イベントを設定し、Segment ダッシュボードで送信先を設定します。
例 2: 複数のトラッキング SDK から移行する
ユーザープロンプト: 「Mixpanel、Amplitude、GA4 の SDK が個別にあります。1 つに統合してください。」
エージェントは、個々の SDK を Segment の単一のトラッキングコードに置き換え、既存のイベントを Segment のスキーマにマッピングし、送信先を有効にします。
ガイドライン
- 最初に Identify、次に Track — イベントを追跡する前に、常にユーザーを識別します
- イベントの命名規則 — "Object Action" 形式: "Order Completed"、"Page Viewed"
- ユーザープロパティの特性 — メール、プラン、会社は
identifyの特性に入れます - イベントデータのプロパティ — 注文合計、製品 ID は
trackのプロパティに入れます - 機密性の高いイベントはサーバー側で — 支払い、サブスクリプションはバックエンドから追跡します
- UI イベントはクライアント側で — クリック、ページビュー、フォームのインタラクション
- ダッシュボード経由での送信先 — コードを変更せずに連携機能を切り替えます
- トラッキング計画 — 実装前にイベントを文書化します。データの拡散を防ぎます
- 匿名 → 識別済み — 匿名ユーザーがサインアップした場合は
alias()を使用します - 無料枠: 1,000 人の訪問者/月 — または、Segment のオープンソースの代替手段を使用してセルフホストします
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Segment
Overview
Segment is a customer data platform — collect events once, route them to every tool in your stack. Instead of adding SDKs for Mixpanel, Amplitude, Google Analytics, Intercom, and BigQuery separately (each with their own tracking code), send events to Segment and it forwards them to all destinations. One API, one event schema, 400+ integrations. Toggle destinations on/off without code changes.
When to Use
- Sending analytics events to multiple tools (Mixpanel + BigQuery + Intercom)
- Don't want to add/remove tracking SDKs when switching tools
- Need a single source of truth for customer events
- Unifying web + mobile + server-side event tracking
- Building a data warehouse pipeline (events → BigQuery/Snowflake)
Instructions
Setup
# Browser (Analytics.js)
# Add to your site:
<script>
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];analytics.factory=function(e){return function(){if(window.analytics.initialized)return window.analytics[e].apply(window.analytics,arguments);var i=Array.prototype.slice.call(arguments);if(["track","screen","alias","group","page","identify"].indexOf(e)>-1){var c=document.querySelector("link[rel='canonical']");i.push({__t:"bpc",c:c&&c.getAttribute("href")||void 0,p:location.pathname,u:location.href,s:location.search,t:document.title,r:document.referrer})}i.unshift(e);analytics.push(i);return analytics}};for(var i=0;i<analytics.methods.length;i++){var key=analytics.methods[i];analytics[key]=analytics.factory(key)}analytics.load=function(key,i){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.setAttribute("data-global-segment-analytics-key","analytics");t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=i};analytics._writeKey="YOUR_WRITE_KEY";analytics.SNIPPET_VERSION="5.2.1";analytics.load("YOUR_WRITE_KEY");analytics.page();}}();
</script>
# Node.js
npm install @segment/analytics-node
Core API Calls
// tracking.ts — The 5 Segment API calls
import { Analytics } from "@segment/analytics-node";
const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY! });
// 1. IDENTIFY — Who is the user?
analytics.identify({
userId: "user_123",
traits: {
email: "kai@example.com",
name: "Kai",
plan: "pro",
company: "Acme",
createdAt: "2026-01-15T00:00:00Z",
},
});
// 2. TRACK — What did they do?
analytics.track({
userId: "user_123",
event: "Order Completed",
properties: {
orderId: "ord_456",
total: 99.99,
currency: "USD",
products: [
{ id: "prod_1", name: "Widget", price: 49.99, quantity: 2 },
],
},
});
// 3. PAGE — What page are they on? (browser-side)
analytics.page({
userId: "user_123",
name: "Pricing",
properties: { url: "https://myapp.com/pricing", referrer: "https://google.com" },
});
// 4. GROUP — What company/team are they part of?
analytics.group({
userId: "user_123",
groupId: "company_789",
traits: { name: "Acme Corp", industry: "Technology", employees: 50, plan: "enterprise" },
});
// 5. ALIAS — Link anonymous to known user (on signup)
analytics.alias({ userId: "user_123", previousId: "anon_abc" });
React Integration
// hooks/useTracking.ts — React hook for Segment tracking
export function useTracking() {
const track = (event: string, properties?: Record<string, any>) => {
window.analytics?.track(event, properties);
};
const identify = (userId: string, traits?: Record<string, any>) => {
window.analytics?.identify(userId, traits);
};
const page = (name?: string, properties?: Record<string, any>) => {
window.analytics?.page(name, properties);
};
return { track, identify, page };
}
// Usage
function PricingPage() {
const { track, page } = useTracking();
useEffect(() => { page("Pricing"); }, []);
return (
<button onClick={() => track("Plan Selected", { plan: "pro", price: 49 })}>
Choose Pro
</button>
);
}
Examples
Example 1: Set up tracking for a SaaS product
User prompt: "Track user signups, feature usage, and purchases — send to Mixpanel, BigQuery, and Intercom."
The agent will set up Segment with identify on signup, track events for key actions, and configure destinations in the Segment dashboard.
Example 2: Migrate from multiple tracking SDKs
User prompt: "We have separate Mixpanel, Amplitude, and GA4 SDKs. Consolidate into one."
The agent will replace individual SDKs with Segment's single tracking code, map existing events to Segment's schema, and enable destinations.
Guidelines
- Identify first, then track — always identify users before tracking events
- Event naming convention — "Object Action" format: "Order Completed", "Page Viewed"
- Traits for user properties — email, plan, company go in identify traits
- Properties for event data — order total, product ID go in track properties
- Server-side for sensitive events — payments, subscriptions tracked from backend
- Client-side for UI events — clicks, page views, form interactions
- Destinations via dashboard — toggle integrations without code changes
- Tracking plan — document events before implementing; prevents data sprawl
- Anonymous → identified — use alias() when anonymous user signs up
- Free tier: 1,000 visitors/month — or self-host with Segment's open-source alternatives