This guide explains how to record conversion events and custom behavioral events on your website. Use rbly.convert() for actions you want to measure as conversions: purchases, signups, form submissions. Use rbly.track() for custom behavioral events that aren't conversions: clicks, interactions, engagement signals.
Before you start
Before setting up events, check that:
Conversion tracking is enabled for your workspace
The Rebrandly tracking script is installed on your website
You have access to your website's code, or a developer who can add a small JavaScript snippet
The tracking script only records events for visitors who arrived via a Rebrandly branded link. Visitors from other sources won't appear in your conversion data.
Add the tracking script to your website
If you haven't already installed the tracking script, add this snippet to every page of your website, inside the <head> tag:
<script src="https://cdn.rebrandly.com/analytics/sdk/v1/rbly.min.js" data-api-key="YOUR_API_KEY"></script>
Replace YOUR_API_KEY with the conversion tracking API key from Settings > Conversion tracking in your Rebrandly account.
Once the tracking script is installed, it automatically tracks page views for any visitor who arrived via a Rebrandly link. Conversion and custom events require an additional step.
Add cdn.rebrandly.com to your Cookie Consent Tool's allowlist (if using Termly or similar) if you want the script to fire regardless of consent status.
Record a conversion event
Use rbly.convert() for actions you want to appear in your conversion reports β purchases, signups, form submissions, and similar actions with business value.
Identify the conversion action you want to track (for example: a purchase confirmation, a form submission).
Add the following call at the point in your code where that action occurs:
rbly.convert('EVENT_LABEL');Replace
EVENT_LABELwith a descriptive name for the action, such aspurchase,signup, ortrial_started.To include revenue with the conversion:
rbly.convert('purchase', 99.99, 'USD', { orderId: 'ORDER-123' });
Record a custom event
Use rbly.track() for behavioral events that aren't conversions β clicks, interactions, or engagement signals you want to capture separately from conversion data.
Add the following call at the point in your code where the event occurs:
rbly.track('EVENT_NAME');Replace
EVENT_NAMEwith a descriptive name, such asnewsletter_clickorvideo_play.To include metadata with the event:
rbly.track('newsletter_click', { source: 'homepage', placement: 'footer_cta' });
Verify your setup
After adding your event calls, test by clicking one of your Rebrandly links, completing the action on your site, and checking your conversion tracking dashboard. Conversion events should appear within a few minutes.
If a visitor has a script blocker enabled in their browser, or their browser blocks requests to conversion tracking endpoints, the tracking script won't fire and the event won't be recorded.

