This guide explains how to set up custom conversion tracking events on your website. Custom events let you tell Rebrandly when something meaningful happens after a visitor clicks one of your branded links β like a purchase, a signup, or a form submission β so you can see which links are actually driving results.
Before you start
Before setting up custom events, ensure:
Conversion tracking is enabled for your workspace
The Rebrandly SDK is installed on your website
You have access to your website's code, or a developer who can add a small JavaScript snippet
The SDK only tracks visitors who arrived via a Rebrandly branded link. Visitors from other sources won't appear in your conversion data.
Add the SDK to your website
If you haven't already installed the SDK, add this snippet to every page of your website, inside the <head> tag:
<script src="https://cdn.rebrandly.com/sdk/v1/rbly.min.js" data-api-key="YOUR_API_KEY"></script>
Replace YOUR_API_KEY with the conversion tracking API key from your Rebrandly account settings.
Once the SDK is installed, it automatically tracks page views for any visitor who arrived via a Rebrandly link. Custom events require an additional step.
Fire a custom event
To track a specific action β like a purchase or signup β add a JavaScript call at the point in your code where that action happens.
Identify the action you want to track (for example: a purchase confirmation, a form submission, a button click).
Add the following call at the point in your code where that action occurs:
rbly.track('EVENT_NAME');Replace
EVENT_NAMEwith a descriptive name for the action, such aspurchase,signup, ortrial_started.To include revenue with the event:
rbly.track('purchase', {product_id: 'prod_123'}, 99.99, 'USD');To include custom metadata (no monetary value):
rbly.track('lead', {\n email: '[email protected]',\n source: 'newsletter'\n});For more examples and parameter details, see the Custom events reference.
Verify your setup
After adding the event code, test it by clicking one of your Rebrandly links, completing the action on your site, and checking your conversion tracking dashboard. The event 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 SDK won't fire and the event won't be tracked. Add cdb.rebrandly.com to your Cookie Consent Tool's allowlist (if using Termly or similar) so the SDK fires regardless of consent status.

