Clicks are the starting point for all conversion events on Dub.

A click event can be triggered by:

In Dub Analytics, you can filter between QR code scans and link clicks, giving you a full picture of how your various marketing channels are performing.

Clicks are tracked automatically for all Dub short links upon a redirect event – and you also have the flexibility to track clicks via query parameters using our Client-side SDK.

Server-side click-tracking

Server-side click-tracking is enabled by default for all Dub links and come with the following attributes:

AttributeTypeDescription
timestampstringThe timestamp of the click event
idstringThe unique ID of the click event
urlstringThe destination URL that the link resolved to – this can vary if geo/device-targeting is enabled
continentstringThe continent of the user who clicked the link
countrystringThe country of the user who clicked the link
citystringThe city of the user who clicked the link
devicestringThe device of the user who clicked the link
browserstringThe browser of the user who clicked the link
osstringThe operating system of the user who clicked the link
refererstringThe referrer of the user who clicked the link
refererUrlstringThe full referrer URL of the user who clicked the link
qrbooleanWhether the click event was triggered by a QR code scan
ipstringThe IP address of the user who clicked the link (non-EU users only)

These events happen on the server-side and cannot be blocked by browser extensions or ad-blockers, which improves the accuracy of your analytics data.

Client-side click-tracking

Alternatively, you can track clicks on the client-side using query parameters (e.g. ?via=john, ?ref=jane). This gives you the flexibility to track clicks directly on your website or app, without needing to rely on link redirects.

A few use cases include:

  • You are migrating from an existing affiliate management platform that uses query parameters to track conversions and don’t want ask your affiliates to update all their links
  • You need to use an unfurled URL for the platform you’re sharing the link on (no short links allowed)
  • You have dynamically generated referral pages (e.g. Tesla) and want to track clicks using a track() function inside your application code.

With our Client-side SDK, you can do exactly that.

Here’s how you can enable client-side click-tracking for your links:

First, you need to add a unique identifier to your links. This identifier is unique across your workspace and will be used to identify the corresponding link when passed as the query parameter (e.g. ?via=jane).

There are two ways to add an identifier to your links:

Step 2: Create a Publishable Key

Next, you’ll need to create a Publishable Key that you’ll use to initialize the Client-side SDK. The key has the following format:

dub_publishable_xxxxxxxxxxxxxxxxxxxxxxxx

You can create a Publishable Key in the Tokens settings page in your Dub workspace.

Step 3: Install the Client-side SDK

Lastly, you’ll need to install the Client-side SDK and initialize it with the Publishable Key you created in the previous step.

Here’s the full list of parameters you can pass to the <Analytics /> component:

To avoid ad-blockers from blocking your click-tracking requests, we recommend setting up a reverse proxy.

Depending on which backend framework you’re using, there are a few different ways to do this:

Once you’ve set up your reverse proxy, don’t forget to update the apiHost parameter in the <Analytics /> component to point to your proxy URL.

Step 5: Verify your setup

To verify that your click-tracking is working, run your website locally with the specific query parameter (e.g. ?via=jane) and check if the following is true:

  1. The click tracked correctly in the Analytics tab of your Dub workspace.
  2. There is a successful /track/click request in your browser’s Network tab (and no errors in the Console tab).
  3. The dub_id cookie is being set in your browser upon a successful click-tracking request.