Configure Stripe Checkout tracking for back-attribution
Step-by-step guide to ensure your Stripe Checkout buttons forward client_reference_id to Metrikia, the prerequisite for back-attributing anonymous touchpoints.
Configure Stripe Checkout tracking for back-attribution
Why this matters
If you sell via Stripe Checkout (or Payment Links buy.stripe.com), your visitors pay before submitting a lead form. Without configuration, Metrikia cannot link the anonymous touchpoints (5 Meta ads viewed over 3 days for example) to the lead created at payment time.
The mechanism relies on the Stripe client_reference_id parameter. The Metrikia pixel auto-injects the visitor's mtk_vid into it. When Stripe completes the checkout, the server webhook reads this client_reference_id and back-attributes every anonymous touchpoint of the visitor to the newly created lead.
Prerequisites
- Metrikia pixel v2.0+ deployed on all your public pages (back-attribution does not work on visitors who never saw the pixel).
- Stripe webhook configured on the Metrikia side (Integrations settings).
Method 1: Direct Stripe link (recommended, zero config)
If your checkout button is an <a> pointing to https://checkout.stripe.com/... or https://buy.stripe.com/..., you have nothing to do. The Metrikia pixel auto-detects these URLs and injects client_reference_id.
Verification:
- Open your payment page in a browser.
- Dev console (F12) โ "Elements" tab.
- Inspect the payment button.
- You should see
client_reference_id=<long-hex>in thehref.
If the parameter does not appear, it means:
- The pixel is not loaded on this page (check
<script src="metrikia-pixel.js">in the HTML). - The button is added dynamically after page load and the
MutationObserverhas not had time to tag it: manually callwindow.mtk('stripeify')after your render.
Method 2: Custom button with data-checkout
If you use an <a data-checkout> or a non-Stripe button that later redirects to Stripe via JavaScript, add the data-checkout attribute:
<a data-checkout href="https://your-app.com/start-checkout">Buy</a>
The pixel will inject client_reference_id on every link marked data-checkout.
If the Stripe redirect happens server-side, you must forward the mtk_vid to your backend and pass it as client_reference_id when creating the Stripe session:
// Read mtk_vid from the frontend
const mtkVid = window.mtk('getVisitorId');
fetch('/start-checkout', {
method: 'POST',
body: JSON.stringify({ mtkVid }),
});
// Backend (PHP example)
$session = \Stripe\Checkout\Session::create([
'client_reference_id' => $request->mtkVid,
// ... other params
]);
Verify back-attribution works
- Open your site in a private window (clean cookie).
- Navigate 2-3 pages.
- Click a test payment button.
- Complete checkout in Stripe test mode.
- Go to /app/leads โ open the created lead โ "Journey" tab.
You should see your 2-3 anonymous touchpoints linked to the lead, with a "back-attributed" mention.
Common issues
- "client_reference_id appears in the URL but the webhook receives null": check your Stripe integration does not reset parameters. On Stripe Payment Links the parameter is preserved. On a server-created session, you must pass it explicitly.
- "The visitor has an mtk_vid but no touchpoint appears before checkout": the pixel was probably not loaded on ad pages. Check the tag is deployed everywhere, not just on the payment page.
- "I changed domains between the pixel and Stripe": this is normal,
client_reference_idcrosses the domain. Themtk_vidcookie stays on your site,client_reference_idtravels as a query string to Stripe then returns in the webhook.
Previous guide
Understanding multi-touch attribution reliability
Next guide
Activate Google Ads tracking (gclid โ ad_id)
To go further, check out our blog, the documentation or contact support.