Dub Cloud Mode Integration Beta

Send events to Dub in RudderStack cloud mode.

After you have successfully instrumented Dub as a destination in RudderStack, follow this guide to correctly send your events to Dub in cloud mode.

warning

Business plan is required for conversion tracking

Dub’s conversion tracking feature requires a Business plan or higher. The Free, Pro, and Starter plans do not support conversion attribution.

How to use the integration

This section gives an overview of how to use the Dub cloud mode integration with RudderStack:

  1. Dashboard setup: Set up the Dub destination in RudderStack.
  2. Initialize the Dub client on your website: Add the @dub/analytics script to your website client on your website before initializing the RudderStack SDK.
  1. 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:

warning

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 eventDub conversion typeUse case
Purchase CompletedSALES_CONVERSIONTrack revenue-generating conversions
Signup CompletedLEAD_CONVERSIONTrack lead generation conversions
Trial StartedLEAD_CONVERSIONTrack free trial signups
Demo RequestedLEAD_CONVERSIONTrack 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:

info

RudderStack sets the mode to wait for the lead event.

See the Dub documentation for more information on this mode.

RudderStack propertyDub field
Description
context.clickId
Required
clickIdUnique dub_id parameter the lead conversion event is attributed to.
event
Required
eventNameName of the event (must match the event mapping specified in the dashboard settings)
externalId.customerExternalId
userId
traits.userId
traits.id
context.traits.id
context.traits.userId
Required
customerExternalIdUnique user identifier in your system.
traits.email
properties.email
customerEmailEmail address of the customer. If not passed, a random email address is generated.
traits.fullName
traits.name
traits.firstName + traits.lastName
customerNameUser’s name. A random name is generated if not specified, for example, Big Red Machine.
traits.avatarcustomerAvatarUser’s avatar URL. A random avatar URL is generated if not specified.
properties.eventQuantityeventQuantityNumerical 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.
propertiesmetadataAdditional metadata stored with the track event — cannot exceed 10,000 characters.
warning
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:

RudderStack propertyDub field
Description
externalId.customerExternalId
userId
traits.userId
traits.id
context.traits.id
context.traits.userId
Required
customerExternalIdUnique user identifier in your system.
eventeventNameName of the event — defaults to Purchase
properties.total
properties.amount
Required
amountAmount of sale in cents
properties.paymentProcessorpaymentProcessorName of the payment processor used for processing the sale
properties.invoiceId
properties.orderId
properties.order_id
invoiceIdUnique ID of the invoice in your system
properties.currencycurrencyCurrency of the sale — defaults to USD
properties.leadEventNameleadEventNameName 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.dubClickIdclickIdUnique ID of the click that the sale conversion event is attributed to. You can read this value from dub_id cookie
traits.fullName
traits.name
traits.firstName + traits.lastName
customerNameUser’s name. A random name is generated if not specified, for example, Big Red Machine.
traits.email
properties.email
customerEmailEmail address of the customer. If not passed, a random email address is generated.
traits.avatarcustomerAvatarUser’s avatar URL. A random avatar URL is generated if not specified.
propertiesmetadataContains additional information about the sale
warning
RudderStack discards any other fields in the traits object apart from the ones listed above.

User identification

RudderStack sets the following hierarchy for identifying a user in Dub:

  1. context.externalId with type customerExternalId
  2. userId field from the event
warning
RudderStack throws an instrumentation error if no customer identifier is found.

Custom properties

RudderStack automatically includes any additional properties from your track event as metadata in Dub:

rudderanalytics.track("Purchase Completed", {
  clickId: "clk_abc123def456",
  revenue: 149.99,
  currency: "USD",
  product_category: "Electronics",
  discount_code: "SAVE20",
  customer_segment: "Premium",
  campaign_source: "email_newsletter"
});

Event processing flow

When you send a track event, RudderStack:

  1. Validates the required fields: Ensures clickId, revenue, and currency are present
  2. Checks event mapping: Verifies the event name is configured in the destination mapping
  3. Maps event data: Converts RudderStack format to Dub’s conversion event format
  4. Handles amount conversion: Multiplies revenue by 100 if the Convert amount to cents setting is enabled
  5. Sends the conversion event: Uses Dub’s conversion attribution API
info
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:

PlanRequests
(per second)
Requests
(per minute)
Free10600
Pro251,500
Starter503,000
Business1006,000
EnterpriseCustom limitsCustom limits
info
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.

success
RudderStack automatically handles this ordering requirement.

Error handling

This section covers common error scenarios and how RudderStack handles them:

Error TypeHTTP CodeDescriptionRetry strategy
Missing clickId400clickId is required for conversion eventsNot retried
Missing revenue400Revenue amount is requiredNot retried
Invalid currency400Currency code is invalidNot retried
Invalid API key401Authentication failedNot retried
Event not mapped422Event name not found in mapping configurationNot retried
Rate limit exceeded429API rate limit exceededRetried with exponential backoff
Server error5xxDub server errorRetried with exponential backoff

Troubleshooting

IssueSteps
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:



Questions? Contact us by Email or on Slack