Segment is a customer data platform (CDP) — once data lands there, it fans out to every downstream tool in your stack simultaneously. HubSpot, Mixpanel, BigQuery, Intercom, Braze, Customer.io — they all receive the same event. If you route GitHub developer signals through Segment, a single GitLeads webhook fires and enriches every tool at once. No duplicate integrations, no data inconsistency.
Why Route GitHub Signals Through Segment
- Single integration, all destinations — one webhook handler populates your entire tool stack
- Consistent identity resolution — Segment merges GitHub profile data with existing user records by email or anonymous ID
- Warehouse-first — GitHub intent events land in BigQuery or Snowflake for SQL analysis alongside product data
- Audience sync — build Segment Audiences of "GitHub stargazers" and sync to ad platforms, email tools, or CRMs automatically
Integration Architecture
GitLeads fires a webhook → your handler calls Segment's Track API → Segment routes the event to all configured destinations. Use the Segment HTTP Tracking API (server-side) for reliable delivery with no client-side SDK required.
Webhook Handler → Segment HTTP API
import { createHmac } from 'crypto';
import { Analytics } from '@segment/analytics-node';
const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY! });
interface GitLeadsPayload {
signal: 'stargazer' | 'keyword';
github_username: string;
name: string | null;
email: string | null;
company: string | null;
location: string | null;
bio: string | null;
followers: number;
top_languages: string[];
repo?: string;
keyword?: string;
context?: string;
matched_at: string;
}
function verifySignature(body: string, sig: string, secret: string): boolean {
const hmac = createHmac('sha256', secret).update(body).digest('hex');
return `sha256=${hmac}` === sig;
}
export async function POST(req: Request) {
const body = await req.text();
const sig = req.headers.get('x-gitleads-signature') ?? '';
if (!verifySignature(body, sig, process.env.GITLEADS_WEBHOOK_SECRET!)) {
return new Response('Unauthorized', { status: 401 });
}
const lead: GitLeadsPayload = JSON.parse(body);
const userId = lead.email ?? `github|${lead.github_username}`;
// Identify the developer — creates/updates user profile in all destinations
analytics.identify({
userId,
traits: {
name: lead.name,
email: lead.email,
company: lead.company,
location: lead.location,
github_username: lead.github_username,
github_followers: lead.followers,
github_bio: lead.bio,
github_top_languages: lead.top_languages,
github_profile_url: `https://github.com/${lead.github_username}`,
},
});
// Track the intent event — fans out to analytics, CRM, email, warehouse
analytics.track({
userId,
event: lead.signal === 'stargazer'
? 'GitHub Repo Starred'
: 'GitHub Keyword Mentioned',
properties: {
repo: lead.repo,
keyword: lead.keyword,
context: lead.context,
matched_at: lead.matched_at,
signal_type: lead.signal,
},
});
await analytics.closeAndFlush();
return new Response('OK');
}Downstream Destinations to Enable
- HubSpot — creates contact with GitHub traits; "GitHub Repo Starred" event updates deal stage or enrolls in sequence
- Mixpanel / Amplitude — GitHub intent events appear alongside product usage for full funnel analysis
- BigQuery / Snowflake — warehouse every signal for cohort and conversion analysis
- Customer.io / Braze — trigger behavioral campaigns from the same GitHub Repo Starred event
- Intercom — creates lead with GitHub company/role context; triggers in-app message if they later sign up
Building GitHub Audiences in Segment
In Segment Engage, create an Audience with condition: "has performed GitHub Repo Starred at least once." Sync this audience to Google Ads, Meta, LinkedIn, or HubSpot lists. Developers who starred your repo will see retargeting ads automatically — without any manual export.
Identity Resolution
If a developer later signs up via your product, Segment merges the anonymous GitHub profile with their authenticated identity. All prior GitHub intent events retroactively associate with the real user, giving your CRM a complete pre-signup history.