Skip to content

How to enrich product analytics with company data at signup

· 6 min read · Company enrichment

To enrich product analytics with company data, look up the domain of each new user's email address at signup, then write the company's industry, employee size and similar fields to that user's properties in your analytics tool, and to a company group if the tool supports groups. Do it from your backend, after the account is created, so signup stays fast and users can't tamper with the values. Once the properties exist, every funnel, retention chart and feature-usage report can be broken down by company size or industry.

This post shows the flow with generic code, then the exact calls for PostHog's Node library and Segment's Node library, both from their public docs.

What you get, and what you don't

A domain lookup gives you facts about the company, not the person. With pingutil's /v1/lookup, the useful analytics fields are:

Field Example values Good for
category company, free, educational, government, isp, disposable Splitting B2B from consumer signups
company.industry / sub_industry free text Breakdowns by vertical
company.employee_size_estimate 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10000+ Segmenting by company size
company.funding_stage bootstrapped, seed, series_a … public, acquired, unknown Startup vs enterprise cohorts
company.headquarters.country free text Rough geography
company.confidence 0 to 1 Filtering out shaky profiles

You won't get a job title, seniority or anything about the individual. That's deliberate: pingutil doesn't do person-level data.

Two honest caveats. The profile is filled by an LLM grounded on the company's homepage, so it can be wrong, especially for small or new companies; how accurate LLM company enrichment is goes into where it fails. And headquarters.country is free text, so normalize it before charting.

Where enrichment belongs in the signup flow

Don't put it on the request path. A cached lookup is quick, but a domain we haven't seen yet needs a fresh profile, which involves an LLM call and takes noticeably longer. The user shouldn't wait for analytics.

  1. User submits the signup form.
  2. Your backend creates the account and responds.
  3. A background job (or a fire-and-forget task after the response) looks up the email domain.
  4. The job writes the company fields to your own database.
  5. The job sends the same fields to your analytics tool as user properties and, where supported, group properties.

Writing to your own database first matters. Analytics properties are hard to backfill or correct at scale; your users table isn't. It also means sales, support and billing can use the same data.

The lookup

// company-lookup.ts (Node 18+, TypeScript)
type Company = {
  name: string | null;
  industry: string | null;
  sub_industry: string | null;
  employee_size_estimate: string | null;
  funding_stage: string | null;
  headquarters: { city: string | null; region: string | null; country: string | null } | null;
  is_public: boolean | null;
  confidence: number | null;
};

type Lookup = {
  domain: string;
  category: 'company' | 'free' | 'disposable' | 'educational' | 'government' | 'isp' | 'unknown';
  company: Company | null;
  verdict: { is_spam: boolean; low_trust: boolean; reason: string | null };
  meta: { enrichment_error?: string; served_stale?: boolean };
};

export async function lookupEmail(email: string): Promise<Lookup> {
  const res = await fetch('https://pingutil.com/v1/lookup', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.PINGUTIL_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ input: email }),
    signal: AbortSignal.timeout(30_000),
  });
  if (!res.ok) throw new Error(`lookup failed: ${res.status}`);
  return (await res.json()) as Lookup;
}

// Flatten into properties your analytics tool can filter on.
export function companyProperties(l: Lookup): Record<string, string | number | boolean | null> {
  const base = { email_category: l.category, company_domain: l.category === 'company' ? l.domain : null };
  const c = l.company;
  if (l.category !== 'company' || !c) return base;

  const confident = (c.confidence ?? 0) >= 0.5;
  return {
    ...base,
    company_name: c.name,
    company_industry: confident ? c.industry : null,
    company_sub_industry: confident ? c.sub_industry : null,
    company_size: confident ? c.employee_size_estimate : null,
    company_funding_stage: confident ? c.funding_stage : null,
    company_country: c.headquarters?.country ?? null,
    company_is_public: c.is_public,
    company_confidence: c.confidence,
  };
}

Notes on the choices here:

  • Every user gets email_category, including free-webmail users. "Activation rate by email category" is one of the most useful B2B charts you can build, and it costs nothing extra.
  • Company fields only for category === 'company'. Addresses at gmail.com or an ISP domain like comcast.net say nothing about an employer.
  • A confidence threshold. 0.5 is a starting point, not a rule. Look at a sample of your own profiles and pick the cut-off where the industry and size look right. Keep company_confidence as a property anyway so you can filter later.
  • Missing profile is normal. If enrichment fails or the daily budget for fresh profiles is used up, company is null and meta.enrichment_error says why (for example daily_enrichment_limit, or domain_unresolvable for domains that don't resolve). Send what you have and re-run later.

Sending it to PostHog

The PostHog integration page has the short version of this setup. PostHog's Node.js library docs document identify for person properties, and its group analytics docs document groupIdentify plus a groups option on capture. Group analytics must be enabled on your PostHog project for the group calls to show up.

// enrich-signup.ts
import { PostHog } from 'posthog-node';
import { lookupEmail, companyProperties } from './company-lookup';

const posthog = new PostHog(process.env.POSTHOG_KEY!, { host: 'https://us.i.posthog.com' });

export async function enrichSignup(userId: string, email: string) {
  const lookup = await lookupEmail(email);
  const props = companyProperties(lookup);

  await saveUserCompany(userId, props); // your own DB first

  posthog.identify({ distinctId: userId, properties: props });

  if (props.company_domain) {
    posthog.groupIdentify({
      groupType: 'company',
      groupKey: String(props.company_domain),
      properties: {
        name: props.company_name,
        industry: props.company_industry,
        size: props.company_size,
        funding_stage: props.company_funding_stage,
        country: props.company_country,
      },
    });
    // Associate an event with the group so the user shows up under it.
    posthog.capture({
      distinctId: userId,
      event: 'company_enriched',
      groups: { company: String(props.company_domain) },
    });
  }

  await posthog.flush();
}

saveUserCompany is yours. In a long-running server, call posthog.shutdown() on process exit rather than after every request; flush() is enough in a job. Also attach groups: { company: ... } to the events you capture from then on, which is how PostHog ties ongoing activity to the company.

Using the registrable domain as the group key is convenient: two people signing up as jane@acme.com and raj@eu.acme.com both land in acme.com, because pingutil keys everything on the registrable domain (eTLD+1).

Sending it to Segment

If Segment is your pipeline, its Node.js source docs document identify with traits and group with a groupId:

import { Analytics } from '@segment/analytics-node';

const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY! });

analytics.identify({ userId, traits: props });
if (props.company_domain) {
  analytics.group({
    userId,
    groupId: String(props.company_domain),
    traits: { name: props.company_name, industry: props.company_industry, employees: props.company_size },
  });
}

Destinations then map those traits into whatever your downstream tools call them.

Keep fake signups out of the numbers

Enrichment is most useful when the cohort it describes is real. The same lookup returns a verdict; send verdict.is_spam and verdict.reason as properties too, so you can exclude disposable and machine-generated accounts from charts. Excluding fake signups from analytics shows the filters per tool.

Budgets and refreshes

On the Free plan each account has a budget of lookups (2,000 a day, 30,000 a month) and a smaller one for fresh company profiles (50 a day, 500 a month); cached profiles don't count toward the fresh-profile budget. In practice, most of your signups after the first weeks come from domains you've already looked up, so the fresh count stays low. If you backfill existing users, spread the job over several days and dedupe by domain first, since one lookup per domain covers every user at that company.

Company facts change slowly. Re-enrich on a schedule (quarterly is plenty for most teams) rather than on every login, and only pass refresh: true when you have a reason to think a profile is out of date.

For the product side of this, see the product analytics use case and the guide to enriching signups with company data. To see what a profile looks like for a domain you care about, try it in the live demo.

Questions people ask

How do I add company data to users in product analytics?
When a user signs up, look up their email domain with a company enrichment API, then send fields like industry and employee size as user properties, and as group (company) properties if your analytics tool supports groups. Do it server-side so users can't alter the values.
Should I enrich users with Gmail or other free webmail addresses?
No. A gmail.com address tells you nothing about the person's employer. Record the email category (free, company, educational and so on) as a property, and only attach company fields when the domain is a company domain.
How accurate is company enrichment from an email domain?
Good for well-known companies with a clear website, weaker for tiny or brand-new ones and for domains that don't match the company name. LLM-based enrichment can also be wrong, so store the confidence value and treat low-confidence profiles as hints, not facts.