Attribute Stripe Payments via Customer Email Matching
Automatically match Stripe charges and subscriptions to website visitors via customer email when metadata or redirect links aren't an option.
Make sure you've connected your Stripe account first.
When you can't pass metadata, credit the payment through the customer's email. On the page buyers land on after paying, call:
js
// On your success page, once you know who paid
window.datasense("payment", { email: customer.email })DataOwl matches it to the Stripe payment with that email, whether the webhook arrived before or after.
Example
Say buyers are redirected to /welcome after checkout. In React:
components/payment-tracker.jsx
"use client"
import { useEffect } from "react"
export function PaymentTracker({ email }) {
useEffect(() => {
window.datasense?.("payment", { email })
}, [email])
return null
}Make it reliable
If the call can run before the script has loaded, add this to the page's <head>, above the script, so the call is queued:
html
<script>
window.datasense = window.datasense || function () {
(window.datasense.q = window.datasense.q || []).push(arguments)
}
</script>When to use it
- Custom checkouts, Stripe Elements and third-party tools built on Stripe
- Mobile app payments
The email is matched as a SHA-256 hash and never stored in plain text.