Initialize the Dub client on your website: Add the @dub/analytics script to your website client on your website before initializing the RudderStack SDK.
See the Dub documentation for more information on how to initialize the Dub script.
Initialize the RudderStack SDK: Initialize the RudderStack SDK after initializing the Dub client. While setting up the SDK, retrieve the clickId value from the cookies and use it to instrument your track events.
See the Property mappings section for more information on how clickId property is mapped.
Track
The track call sends conversion events to Dub for attribution tracking. Use these events to:
Track conversions back to specific campaign clicks
Measure campaign performance and ROI
Attribute sales and leads to marketing channels
A sample track call is shown below:
rudderanalytics.track('User Signed Up',{userId:'abc123',firstName:'John',lastName:'Doe',customerAvatar:'https://example.com/avatar.jpg'},{dubClickId:'ABC123',traits:{email:'xyz@example.com'}});
RudderStack processes only events that have a valid clickId and are mapped to Dub conversion events in the dashboard settings before successfully sending them to Dub.
Events without a clickId or not configured in the event mapping will fail.
Mapping setup
Before sending track events, make sure to configure event mappings in your Dub destination settings to map RudderStack events to Dub conversion types.
An example is shown below — you can add these mappings based on your requirement:
RudderStack event
Dub conversion type
Use case
Purchase Completed
SALES_CONVERSION
Track revenue-generating conversions
Signup Completed
LEAD_CONVERSION
Track lead generation conversions
Trial Started
LEAD_CONVERSION
Track free trial signups
Demo Requested
LEAD_CONVERSION
Track demo requests
Property mappings
This section explains the property mappings for the Lead and Sale conversion events.
Lead event
A Lead event occurs when a user performs an action that is not related to a revenue-generating conversion. For example, a user signing up for an account, adding a product to the cart, etc.
RudderStack maps the following properties in the track events (mapped to the LEAD_CONVERSION event in the dashboard settings) to the corresponding Dub fields:
RudderStack sets the mode to wait for the lead event.
User’s name. A random name is generated if not specified, for example, Big Red Machine.
traits.avatar
customerAvatar
User’s avatar URL. A random avatar URL is generated if not specified.
properties.eventQuantity
eventQuantity
Numerical value associated with this lead event, for example, number of provisioned seats in a free trial. If defined as x, the lead event will be tracked x times.
properties
metadata
Additional metadata stored with the track event — cannot exceed 10,000 characters.
RudderStack discards any other fields in the traits object apart from the ones listed above.
Sale event
A Sale event occurs when a user performs an action that is related to a revenue-generating conversion. For example, subscribing to a paid plan, upgrading from one plan to another, etc.
RudderStack maps the following properties in the track events (mapped to the SALES_CONVERSION event in the dashboard settings) to the corresponding Dub fields:
Name of the lead event that occurred before the sale — it is case-sensitive. Note that:
You can use this name to associate the sale event with a particular lead event (instead of the latest lead event for a link-customer combination — the default behavior)
For direct sale tracking, you can also use this field to specify the lead event name
context.dubClickId
clickId
Unique ID of the click that the sale conversion event is attributed to. You can read this value from dub_id cookie
Validates the required fields: Ensures clickId, revenue, and currency are present
Checks event mapping: Verifies the event name is configured in the destination mapping
Maps event data: Converts RudderStack format to Dub’s conversion event format
Handles amount conversion: Multiplies revenue by 100 if the Convert amount to cents setting is enabled
Sends the conversion event: Uses Dub’s conversion attribution API
RudderStack does not send the events if any validation fails. These events may appear as a failed event in your destination.
Rate limits
Dub enforces rate limits that vary by subscription plan:
Plan
Requests (per second)
Requests (per minute)
Free
10
600
Pro
25
1,500
Starter
50
3,000
Business
100
6,000
Enterprise
Custom limits
Custom limits
If rate limits are exceeded, Dub returns a 429 Too Many Requests error. RudderStack automatically handles these errors with exponential backoff retry logic.
Event ordering
Dub requires strict event ordering for proper conversion attribution — the mandatory flow is Click > Lead > Sale. If events are processed out of order (for example, sale before lead), the conversion attribution chain will be broken and events may not be properly tracked.
RudderStack automatically handles this ordering requirement.
Error handling
This section covers common error scenarios and how RudderStack handles them:
Error Type
HTTP Code
Description
Retry strategy
Missing clickId
400
clickId is required for conversion events
Not retried
Missing revenue
400
Revenue amount is required
Not retried
Invalid currency
400
Currency code is invalid
Not retried
Invalid API key
401
Authentication failed
Not retried
Event not mapped
422
Event name not found in mapping configuration
Not retried
Rate limit exceeded
429
API rate limit exceeded
Retried with exponential backoff
Server error
5xx
Dub server error
Retried with exponential backoff
Troubleshooting
Issue
Steps
Events failing in RudderStack
Verify that you have configured event mappings for your event names
Your events include a valid clickId
Required fields (revenue, currency) are present
Check if the rate limits are exceeded (varies by your Dub plan)
Conversions not appearing in Dub dashboard
Verify that your API key has the required permissions to send conversion events
Event mappings are correctly configured
Events must include valid clickId values
You are on a Business plan or higher (required for conversions)
Authentication errors
Verify your API key is correct and active
Ensure your Dub account is on the Business plan or higher
Check that the API key has permissions for conversion events
Best practices
This section includes some best practices for correctly using the Dub integration with RudderStack.
Event naming
Use consistent, descriptive event names in your mappings:
// Good: Clear and specific
rudderanalytics.track("product_purchase_completed",{...});rudderanalytics.track("demo_request_submitted",{...});rudderanalytics.track("trial_signup_completed",{...});// Avoid: Generic or unclear
rudderanalytics.track("event",{...});rudderanalytics.track("action",{...});
Attribution timing
For accurate attribution, send conversion events as soon as possible after the conversion occurs. Delaying conversion tracking can impact attribution accuracy:
// Send conversion event immediately after purchase
rudderanalytics.track("Purchase Completed",{clickId:processedPurchase.clickId,revenue:processedPurchase.amount,currency:processPayment.currency});
Metadata structure
Organize your conversion metadata in a logical structure:
rudderanalytics.track("Purchase Completed",{clickId:"clk_abc123def456",revenue:99.99,currency:"USD",// Product information
product_id:"prod_456",product_name:"Premium Plan",product_category:"SaaS Subscription",// Customer information
customer_segment:"enterprise",customer_type:"existing",// Campaign data
campaign_type:"email",campaign_name:"monthly_newsletter",utm_source:"email",utm_medium:"newsletter",utm_campaign:"product_launch"});
See also
See the following Dub API documentation for more information:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.