Setup guide
Add the snippet and connect Stripe
Install the 2 KB script and attribute Stripe payments to traffic sources.
You need
- A website where you can edit the <head>
- A Stripe account and a server that creates Checkout Sessions
Step 1: Add your site
In ClickMesh, open Sites and add your domain. You get a site key.
Step 2: Paste the snippet
Put the snippet in the <head> of every page, replacing YOUR_SITE_KEY. It loads with defer, so it does not block rendering. It records pageviews, referrers, UTM campaigns and countries, and sets a random first-party visitor ID.
HTML<script defer data-site="YOUR_SITE_KEY" src="https://hopwire.xyz/cm.js"></script>Step 3: Check that pageviews arrive
Open your site in a new tab. The visit should appear in the site dashboard shortly. If not, check that an ad blocker or a Content Security Policy is not blocking the script.
Step 4: Add the Stripe webhook
ClickMesh shows a webhook endpoint URL for your site. In the Stripe Dashboard, go to Developers → Webhooks, add an endpoint with that URL, and select these two events:
checkout.session.completedinvoice.paid
Step 5: Paste the signing secret
After saving the endpoint, Stripe shows its signing secret (it starts with whsec_). Paste it into ClickMesh. ClickMesh uses it to verify that each webhook really came from Stripe.
Step 6: Pass the visitor ID into Checkout
In the browser, read the visitor ID from the snippet and send it to your server with the checkout request. When your server creates the Checkout Session, put it in metadata as cm_vid. That is how a payment is matched to the visit and its traffic source.
Browserconst cm_vid = window.clickmesh?.visitorId(); await fetch('/api/checkout', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ priceId, cm_vid }), });Server (Node, stripe library)const session = await stripe.checkout.sessions.create({ mode: 'payment', line_items: [{ price: req.body.priceId, quantity: 1 }], success_url: 'https://your-site.example/thanks', metadata: { cm_vid: req.body.cm_vid }, });Same page, no server round trip (if you build the session params in the page)metadata: { cm_vid: window.clickmesh.visitorId() }Step 7: Test it
In Stripe test mode, buy something with a test card. In ClickMesh the payment appears with the source and UTM campaign of the visit that started the checkout.
The snippet does not collect names or email addresses. If you need cookie consent where you operate, include ClickMesh in your consent setup.
Questions about this setup? Email [email protected].
Set it up on the free plan
120k clicks and 50k pageviews a month, Stripe revenue for one site, no time limit.
Start free