← Back to Insights

How to Send Hashed User Data with the OpenAI Ads Pixel

Supplying hashed identifiers like email to the OpenAI Ads pixel and Conversions API improves how conversions match back to ad clicks. Here's the normalization rule that has to match on both sides, working code, and what never to send.

2026-08-12 • Guide

When customers interact with ads on mobile phones and buy hours later on a laptop, click cookies like oppref cannot bridge the cross-device gap alone.

To connect those touchpoints back to your campaigns, OpenAI Ads supports hashed first-party customer identifiers like email addresses and internal account IDs.

Because SHA-256 is a one-way deterministic algorithm, a single stray space or capital letter produces a completely different 64-character hash string. If your browser script lowercases an email while your server hashes raw input, the two strings will never match, and cross-device attribution fails silently.

Here is how to properly normalize, hash, and format customer identity fields across both browser pixel tags and server-side Conversions API (CAPI) dispatches.

How customer matching works

The oppref click token captured by the browser pixel in a first-party __oppref cookie handles same-device attribution within a 30-day window.

Attaching hashed customer identifiers provides a second identity anchor that survives cross-device journeys. If a customer clicks an ad inside ChatGPT on their mobile phone and completes the purchase hours later on a laptop using the same email, OpenAI's attribution engine can reconcile the conversion.

Normalization and SHA-256 formatting

SHA-256 converts any text input into an immutable 64-character hexadecimal digest. Because hashes cannot be reversed or fuzzily matched, your frontend and backend hashing functions must normalize input strings identically:

  1. Strip leading and trailing whitespace.
  2. Convert all characters to lowercase.
  3. Compute the SHA-256 hash across the normalized UTF-8 string.
  4. Output the digest as a 64-character lowercase hexadecimal string.

If your client-side script trims and lowercases an email while your backend webhook hashes the raw database string with uppercase letters, the two hashes will never match.

Client-side hashing with Web Crypto API

Modern browsers provide native SHA-256 hashing via the standard Web Crypto API without external dependencies:

async function hashEmail(rawEmail) {
  if (!rawEmail) return null;
  const normalized = rawEmail.trim().toLowerCase();
  const encoder = new TextEncoder();
  const data = encoder.encode(normalized);
  const hashBuffer = await crypto.subtle.digest("SHA-256", data);
  const hashArray = Array.from(new Uint8Array(hashBuffer));
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
}

// Example execution
const emailHash = await hashEmail("  Jane.Doe@Example.com  ");

Passing user data in browser pixel initialization

In client-side scripts, customer metadata is passed inside the user configuration object during oaiq("init", ...):

<script>
  oaiq("init", {
    pixelId: "YOUR-PIXEL-ID",
    user: {
      email_sha256: "b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514",
      external_id_sha256: "73d83a078369bb4f0971b317aa7797a91cf5c0df1b62161c2e47d75c33ab5b6e",
      country: "US",
      city: "San Francisco",
      zip_code: "94107"
    }
  });
</script>

Client implementation considerations:

User metadata is request-scoped at initialization. Declare it inside init instead of repeating parameters inside individual measure calls.

If a visitor logs in after the initial pageview, invoke init again with the updated user object.

The external_id_sha256 parameter represents a stable, pseudonymous customer identifier from your database (such as an internal customer ID), hashed with SHA-256.

Country codes must follow two-letter ISO 3166-1 formatting. City names should be passed as standard strings.

All hashes must be lowercase 64-character hexadecimal strings. Never transmit raw plaintext emails or phone numbers.

Passing user data in server-side CAPI dispatches

On the Conversions API, customer parameters live inside the user property of each event payload:

{
  "id": "order_12345",
  "type": "order_created",
  "timestamp_ms": 1773892800000,
  "action_source": "web",
  "source_url": "https://shop.example.com/checkout/confirmation",
  "user": {
    "email_sha256": "b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514",
    "external_id_sha256": "73d83a078369bb4f0971b317aa7797a91cf5c0df1b62161c2e47d75c33ab5b6e",
    "country": "US",
    "city": "San Francisco",
    "zip_code": "94107",
    "ip_address": "203.0.113.1",
    "user_agent": "Mozilla/5.0"
  },
  "data": {
    "type": "contents",
    "amount": 8998,
    "currency": "USD"
  }
}

Server payloads accept ip_address and user_agent alongside hashed parameters, reflecting data natively available to backend request handlers.

Verify that your backend programming language (Node.js, Python, PHP) executes the exact same trim and lowercase normalization steps before generating the SHA-256 digest.

Hashing an email does not exempt it from privacy compliance. A SHA-256 hash remains pseudonymous data derived from an identifiable individual and requires appropriate user consent under GDPR and CCPA guidelines.

If a visitor consents to basic measurement but rejects advanced ad personalization, emit conversion events (order_created, page_viewed) while omitting the email_sha256 and external_id_sha256 properties.

Verifying hash parity across client and server

Verify your hashing logic before deploying to production:

  1. Pass a known test email (such as Test.User@example.com) through your frontend JavaScript function and backend server hashing script.
  2. Compare the output strings character by character to confirm identical 64-character hex digests.
  3. Test with debug: true set in pixel options to verify console payloads.
  4. Inspect staging CAPI requests to confirm server payloads format email_sha256 consistently.

Maintaining identical normalization rules across both client scripts and server workers ensures your cross-device conversion signals reconcile cleanly.

Before pushing customer hashing logic to production, install OpenAI Ads Pixel Helper to verify oaiq init payloads trigger cleanly while sensitive fields stay redacted inside your test popup.

Need ChatGPT tracking installed?

Configured, tested, documented.