Email-based attribution

Track payments using customer email when you can't pass cookies.

Back to revenue attribution

How it works

The primary attribution method is passing the attribu_visitor_id cookie through Stripe metadata. But sometimes cookies aren't available - the payment happens on a third-party processor, in a mobile app, or through a custom checkout that doesn't share your domain's cookies.

In these cases, you can use the customer's email address to link the payment back to a visitor. When attribu.tech receives a payment event with an email, it looks for a visitor who was previously identified with that same email and attributes the revenue to their traffic source.

Send a payment event

On your success page or post-purchase confirmation, call window.attribu() with the payment event type and the customer's email:

window.attribu("payment", {
  email: "customer@example.com",
});

React / Next.js example

If you have the customer's email available (from auth, a prop, or a query param), fire the payment event in a useEffect:

// app/success/page.tsx
"use client";

import { useEffect } from "react";

export default function SuccessPage({ user }: { user: { email: string } }) {
  useEffect(() => {
    window.attribu("payment", {
      email: user.email,
    });
  }, [user.email]);

  return <h1>Thanks for your purchase!</h1>;
}

Queue script for reliable tracking

If the payment event fires before the attribu.tech script has loaded, it will be lost. Add the queue snippet to your <head> so events are buffered until the script is ready:

<script>
  window.attribu = window.attribu || function() {
    (window.attribu.q = window.attribu.q || []).push(arguments);
  };
</script>

With the queue in place, you can call window.attribu() anywhere on the page, even before the tracking script loads. Queued events are replayed automatically.

When to use email attribution

  • Third-party payment processors - Gumroad, Paddle, FastSpring, or any processor where you can't pass cookie metadata.
  • Mobile app payments - In-app purchases where browser cookies aren't accessible.
  • Custom checkout flows - Checkout pages on a different domain where the attribu_visitor_id cookie isn't available.
  • Offline or manual payments - Invoices, bank transfers, or other payment methods outside your web checkout.
For email attribution to work, the visitor must have been previously identified with the same email address. Use window.attribu("identify", { email: "..." }) when the user signs in or fills out a form.

Duplicate handling

attribu.tech automatically ignores duplicate payment events. If the same email triggers multiple payment events in a short window, only the first one is recorded. This means you don't need to worry about retries, page refreshes, or the event firing more than once.

What's next

Copied