Install on Vanilla JavaScript
Plain HTML, no framework, no bundler. Script tag in the head of every page for click capture; sales record through your payment gateway, server-to-server, or coupon codes.
The simplest install in the framework set: drop the Rekomi script tag in the <head> of every public page on your site so affiliate clicks are captured. No framework abstractions, no next/script, no bundler, just plain HTML. Recording the sale itself happens off the page (through your payment gateway, a server-to-server call, or a coupon code), so there is nothing to fire on the thank-you page.
If your site uses a shared header partial (Jekyll's _includes/head.html, Hugo's layouts/partials/head.html, Eleventy's _includes/head.html, or any static site generator's templating), you install the script once in the partial and every page picks it up. If your site is a single static HTML file (or a handful of un-templated pages), paste it into each page's <head> directly.
Install the head script
In your shared <head> partial (or each page's <head> if no shared partial):
<!-- Rekomi tracking -->
<script async src="https://api.rekomi.com/api/v1/r/loader.js" data-program-id="YOUR_PROGRAM_ID"></script>
<noscript>
<img src="https://api.rekomi.com/api/v1/r/c.gif" width="1" height="1" alt="" referrerpolicy="no-referrer-when-downgrade" />
</noscript>Copy the snippet with your program ID already filled in from your campaign's install recipe under Setup > Install in the dashboard.
The async attribute means the browser loads Rekomi in parallel with the rest of the page. No measurable Lighthouse impact. The <noscript> block fires a 1x1 pixel for JS-disabled visitors so basic click capture still works.
Recording the sale
The browser pixel no longer records sales, so there is no thank-you-page convert snippet to add. A sale is recorded through one of these paths:
- Your payment gateway. If you bill through a natively connected gateway (Stripe, Paddle, Braintree, Shopify, Wix, Lemon Squeezy, Chargebee, Polar, Recurly, Gumroad, Creem, or Dodo Payments), connect it once in the Connect payment gateway step at
/dashboard/setup/connect-salesand every sale, refund, and cancellation is recorded automatically with no relay to build. - Server-to-server. If you have any backend at all (even a serverless function), POST the sale to Rekomi's S2S endpoint with an HMAC signature. This is the most reliable path because it does not depend on the browser. See Server-to-server tracking.
- Coupon codes. If you cannot run any server-side code, give each affiliate a unique discount code (
Campaign > Coupons). A redeemed code credits the affiliate at checkout with nothing on your thank-you page.
Carry the affiliate referral into whichever path you use: window.Rekomi.getReferral() returns the captured slug so you can stamp it on a Checkout session's subscription metadata (rekomi_affiliate_slug) or forward it to your backend for the S2S call.
Capturing leads (optional)
window.Rekomi.convert() is now a LEAD capture call, not a sale. Use it on a signup or waitlist page to tie a customer email to the referral before they pay, so a later sale is still credited even if the click is gone:
<script>
window.Rekomi && window.Rekomi.ready(function () {
window.Rekomi.convert("customer@example.com");
});
</script>Browser lead capture works on every plan; the server-side lead endpoint requires Starter or higher. See Track leads and signups.
How the referral is stored
The Rekomi loader persists the affiliate slug to localStorage on your domain for up to 90 days. Your campaign's attribution window setting still governs whether a conversion is credited. window.Rekomi.getReferral() reads it back. A _rkmi cookie is set on Rekomi's tracking domain (redirect links, click beacons), so your own server cannot read the slug from a request cookie; use getReferral() in the browser, or carry the slug through your checkout as shown above.
If the visitor clears site data between click and purchase, attribution can still recover through a captured lead: when you record the customer's email as a lead before purchase (via window.Rekomi.convert(), the form auto-capture, or the S2S lead endpoint), a later sale with the same email is credited to that affiliate. Without a lead, use coupon codes or carry the referral into checkout.
Quirks worth knowing
Every page needs the script if you don't have a shared partial. Pasting it on one page only means clicks on other pages are not captured. The most common bug is forgetting a page (the pricing page, or a campaign-specific landing page). Audit your top-of-funnel surfaces.
Async doesn't block. The async attribute means the browser doesn't wait for Rekomi to load before parsing the rest of the page. The Critical Rendering Path is unaffected. Lighthouse scores don't move.
<noscript> fallback for JS-disabled visitors. The <noscript> 1x1 pixel fires for the small population of visitors with JS disabled, so click capture still works through the pixel request.
Same domain matters for attribution. Install the script on the same domain your affiliates send traffic to. localStorage is scoped per origin, so a referral captured on www.example.com is not readable on a different domain.
When to record server-side
If your stack has any backend at all (even a serverless function), recording sales server-side via Rekomi's S2S API is the most reliable path. Browser tracking can be blocked by uBlock Origin, Brave Shields, Pi-hole, or corporate firewalls. Server-side calls go around all of that.
See Server-to-server tracking for the HMAC pattern. If you're on a backend-heavy stack (Rails, Django, etc.), the framework-specific docs in this section cover the S2S install for each.
Troubleshooting
window.Rekomi.getReferral() returns null. The loader had not captured a referral on this browser: either the visitor did not arrive through an affiliate link, or the script is missing on the landing page they hit first. Confirm the script tag is present in View Source on every top-of-funnel page.
Referral captured but the sale is not attributed. The referral did not travel into your checkout. Confirm you stamp window.Rekomi.getReferral() on the Checkout session's subscription metadata (rekomi_affiliate_slug) or forward it to your S2S call, and that your gateway is connected in the Connect payment gateway step.
Sale recorded with the wrong amount. For S2S, amountCents must be an integer in minor units. $49.00 = 4900. Sending a decimal, or multiplying an already-cents value by 100, is the most common bug.
Related
- Tracking script and
window.Rekomireference - Server-to-server tracking: the HMAC pattern for any backend
- Track leads and signups
Install on Carrd
Hidden Embed element with Location set to Head on Pro Standard or higher, or the Pro Plus site-wide Code field. Carrd's single-page nature means the cookie persists naturally.
Install on Next.js App Router
Use next/script in app/layout.tsx with strategy="afterInteractive". Raw script tags in metadata get stripped. Pass the affiliate slug from the client via window.Rekomi.getReferral().