Lemon Squeezy revenue attribution
Set the receipt button link back to your site, or put the visitor id in checkout custom data.
Before you start
Your Lemon Squeezy store must be connected to Chartsy (Lemon Squeezy connection guide) and set as the site's Revenue account under Settings → domains, with the Chartsy tag on your site.
Lemon Squeezy buyers are matched to signups by email automatically. Pick the method below that fits how you sell to also credit buyers who pay with a different email - or never sign up. Both match by visitor id, so they keep working with GDPR mode on.
2Creating checkouts from your server: add custom data
Lemon Squeezy sends checkout custom data to Chartsy's webhook, so put the visitor's chartsy_visitor_id cookie there:
import { createCheckout } from '@lemonsqueezy/lemonsqueezy.js';
await createCheckout(storeId, variantId, {
// ...your existing options
checkoutData: { custom: { chartsy_visitor_id: req.cookies.chartsy_visitor_id || '' } },
});Custom data only reaches Chartsy through the webhook, so it works for purchases made after you connected the store.
Email matching and GDPR mode
- Without either method, Lemon Squeezy buyers are still matched by email to people who signed up. Calling
window.chartsy.identify({ email })on your post-purchase page works too. - With GDPR mode on for the Lemon Squeezy source, no emails are stored, so email matching stops - the two methods above keep working.


