Documentation/Integrations/Conversion Tracking

Conversion tracking

The Rampify tracker records page views and outbound clicks automatically. A conversion is the moment that matters to you: a signup, a demo request, a waitlist form. Rampify credits each conversion to how the visitor first arrived in that browsing session (Google, a campaign link, ChatGPT, a newsletter), so you can see which sources and landing pages actually produce signups.

Conversions carry no personal data. Rampify records the session, the page, a label and an opaque conversion ID that you can store next to your own user record if you want to join the two later.

Install the tracker#

Add the script to every page you want tracked, before the closing </head> tag. Your site ID is on your project's Settings page.

<script defer src="https://www.rampify.dev/tracker.js" data-site-id="YOUR_SITE_ID"></script>

If your own code calls window.rampify, see Calling the tracker before it loads for a short addition that makes early calls safe.

Record a conversion#

Pick the option that matches how your signup works.

A plain HTML form. Add data-rampify-conversion with a label. The tracker records the conversion when the form is submitted and adds a hidden rampify_cid field so the conversion ID rides along with your own form post.

<form action="/signup" method="post" data-rampify-conversion="signup">
  …
</form>

A JavaScript or hosted signup (Clerk, Auth0, Supabase Auth, Google sign-in, Stripe, Typeform, a single-page app). Call trackConversion when the signup succeeds:

window.rampify.trackConversion({ label: 'signup' });

If you want to store the conversion ID with the new user, read it with window.rampify.getConversionId() before the signup completes (for example into Clerk's unsafeMetadata). trackConversion sends that same ID.

Fire it at account creation

Call trackConversion as soon as the account exists, not after email verification. A verification link usually opens in a new tab, which is a new browsing session with no link to the visit that brought the person in.

From your backend. If you'd rather record the signup server-side (for example in a webhook), send the visitor's session with it so the conversion keeps its source. Read the session in the browser with window.rampify.getSessionId(), pass it to your backend with the signup, then post the event with a project API key:

curl -X POST https://www.rampify.dev/api/collect/event \
  -H "Authorization: Bearer sk_live_…" \
  -d '{"event_type":"form_submit","url":"https://app.example.com/signup","label":"signup","sess":"<session id>","cid":"<conversion id>"}'

A backend conversion sent without sess is still counted, but it has no source attached.

Choosing a label#

The label names the action. Use one of these so your conversions group cleanly in Traffic, and pick a short label of your own only when none fits:

LabelUse it for
waitlistJoining a waitlist or early-access list
signupCreating an account or starting a trial
purchasePaying: a completed checkout or a started subscription
bookingBooking a call or demo (Cal.com, Calendly)
contactSending a message or asking for a quote
installAdding your product: an integration, extension, app or MCP connector
chatStarting a conversation with your site's chat or AI assistant

If you have several of one kind, start with the standard label and add a detail, for example booking_discovery_call and booking_onboarding.

When your AI tool asks which pages convert, Rampify also groups each conversion under the goal its label starts with, so booking_discovery_call counts as a booking and you can compare bookings with bookings.

Testing your setup? First open your live site once with ?rampify_owner=true added to the address (https://example.com/?rampify_owner=true), in the browser you'll test from. Everything from that browser, test conversions included, is then marked as yours and left out of every report, and a conversion you make from it still confirms your setup. To undo it, clear the site's storage in that browser.

A conversion that shouldn't count? For a test you made before marking your browser, or spam, open it in Traffic → Conversions and choose Exclude as a test or Exclude as spam, or ask your AI tool to exclude it (it finds it with list_conversions and excludes it with update_conversions once you agree). An excluded conversion stops counting everywhere in Rampify and moves to the Excluded list, where Count it again puts it back.

Calling the tracker before it loads#

The tracker loads with defer, so window.rampify doesn't exist until it has run. If your code might call it earlier (a signup that completes quickly, or a single-page app that starts before the tracker), add this small script before the tracker tag:

<script>
window.rampify = window.rampify || { q: [] };
['trackConversion', 'ready'].forEach(function (m) {
  window.rampify[m] = window.rampify[m] || function () { (window.rampify.q = window.rampify.q || []).push([m, arguments]); };
});
window.rampify.decorateUrl = window.rampify.decorateUrl || function (u) { return u; };
</script>
<script defer src="https://www.rampify.dev/tracker.js" data-site-id="YOUR_SITE_ID"></script>

With it in place, window.rampify.trackConversion(...) works at any time: calls made before the tracker loads are queued and sent once it starts, in order, after the page view.

Functions that return a value can't be queued. Wrap them in ready, which runs your callback as soon as the tracker is live (immediately if it already is):

window.rampify.ready(function (rampify) {
  var conversionId = rampify.getConversionId();
  // store conversionId with your signup, e.g. in Clerk's unsafeMetadata
});

Before the tracker loads, the stub's decorateUrl returns the URL unchanged, so links still work; they just don't carry the session yet.

These names won't change. The window.rampify functions (trackConversion, getConversionId, getSessionId, decorateUrl, ready) and the data-* attributes on this page are only ever added to, never renamed or removed, so code you write against them keeps working.

Sites on more than one subdomain#

A common setup is a marketing site on example.com and signup on app.example.com. Browsers keep each subdomain's session storage separate, so without extra setup the visit to app.example.com starts a new session whose source is your own marketing site. The signup then shows up as a referral from example.com, and the real source (Google, a campaign, ChatGPT) is lost.

To keep it as one session, list the sister domain on both sites, with the same site ID:

<!-- on example.com -->
<script defer src="https://www.rampify.dev/tracker.js"
        data-site-id="YOUR_SITE_ID" data-link-domains="app.example.com"></script>

<!-- on app.example.com -->
<script defer src="https://www.rampify.dev/tracker.js"
        data-site-id="YOUR_SITE_ID" data-link-domains="example.com"></script>
  • data-link-domains takes a comma-separated list of hostnames. *.example.com matches every subdomain of example.com, but not example.com itself, so list both if you need both.
  • Both sides need the attribute. The sending page adds the session to links, and the receiving page only accepts it when it lists the sending domain too.
  • Without the attribute the tracker behaves exactly as before.

How it works#

When a visitor clicks a link to a listed domain, the tracker adds rampify_sid=<session>.<time> to that link. The tracker on the destination page continues that session, then removes the parameter from the address bar before recording the page view, keeping your other query parameters and your router's state. The visit to the app isn't recorded as a referral from your own site, so the conversion is credited to how the visitor originally arrived.

There are no cookies. The parameter expires two minutes after the click, and it's only accepted when the visitor came from your own domains, so a copied or shared link can't merge two people into one session.

Links are handled automatically, including middle-click and "open in new tab". If you send visitors to the other domain from code (location.href = … or window.open(…)), pass the URL through decorateUrl first:

window.location.href = window.rampify.decorateUrl('https://app.example.com/signup');

It adds the session only for listed domains and returns any other URL unchanged.

Single-page apps#

If app.example.com is a single-page app (React, Vue, Svelte, Vite), put the tracker tag before your app's bundle in index.html, so the parameter is removed before your router reads the URL.

App subdomains with logged-in users

If your app subdomain is also where signed-in customers use your product, load the tracker there only on your signup pages for now. Otherwise everyday product usage is counted alongside your marketing traffic, for example returning users opening the app directly show up as Direct visits.

What changes in your reports#

After you add the attribute, visits that move between your domains count as one session instead of two. Expect fewer sessions, fewer referrals from your own domain, and conversions moving from "referral from example.com" to their real source. That's the attribution getting more accurate, not a drop in traffic.

Limits#

  • Forms on one domain that post directly to the other aren't carried across. Link to the signup page instead, or use decorateUrl on the form's action.
  • A visitor who types the app's address or opens it from a bookmark starts a new session as usual.