Skip to main content
This guide explains how to implement ehash — a hashed version of a user’s email address — as a user identifier to enable cross-device tracking and session stitching in GA4. By hashing email addresses collected on-site and sending them as an event parameter (ehash) to GA4, you can help SegmentStream’s identity graph more accurately associate sessions and users across devices and channels. To support this:
  • All links in marketing emails should include the ehash parameter in the URL.
  • All email addresses captured onsite (e.g., during checkout or signup) must be hashed client-side and sent to GA4 as event parameters.
You don’t need to implement every step at once — each part of the setup provides value on its own. For example, capturing ehash from forms now allows you to start tracking, and adding the parameter to email links can be done later.
This guide outlines all the steps required to fully enable ehash based cross-device tracking.
When a user submits their email on your site:
  • Generate a hash (e.g., using SHA-256).
  • Store it in your backend.
  • Include the hashed email as a query parameter in all email links:
https://www.example.com/landing-page?ehash=hashedemail123
This allows you to recognise and associate users on different devices when they click through from an email.
When a user lands on your site with an ehash parameter in the URL, SegmentStream automatically captures it — no additional Segment or GA4 configuration is needed for this step.

Capture and hash emails from on-site forms

When a user submits an email (e.g., through a popup or signup form), send an event to GA4 along with the ehash event parameter by following these steps:
  1. Hash the email when a user submits a form.
  2. Send a Segment track() call including the ehash.
Example:
analytics.track("Email Form Submitted", {
  ehash: "<sha256 hashed email>",
  form_id: "newsletter_popup"
});

Forwarding ehash to GA4 (Segment Destination settings)

The GA4 Destination in Segment forwards all event properties by default. So as long as your track() call includes the property below, GA4 will receive this as an event parameter:
{
  "ehash": "123hashed"
}
This ensures the ehash parameter is sent to GA4 when a user subscribes to the newsletter. SegmentStream can then automatically match the user if they later click a newsletter link containing the same ehash, linking it back to the original subscription device.

Capture and hash email on checkout

When the purchase is completed and the customer email is available:
  1. Hash the email.
  2. Include it in the Segment Purchase event (or whatever your ecommerce library sends).

Example using Segment’s ecommerce spec:

analytics.track("Order Completed", {
  order_id: "T12345",
  total: 59.99,
  currency: "USD",
  products: [
    {
      product_id: "SKU_123",
      name: "Wireless Mouse",
      price: 29.99,
      quantity: 2
    }
  ],
  ehash: "<sha256 hashed email>"
});
Segment’s GA4 destination will forward ehash automatically.
By capturing and hashing the email at both the subscription and checkout stages, SegmentStream can reconstruct the full user journey and attribute value accurately to each marketing interaction the user had before converting.