Skip to main content

Dealing with Ad Blockers

Ad blockers may prevent device fingerprinting and tracking scripts from running on your application. This can cause decreased accuracy in device identification. To mitigate this, set up a custom subdomain for Dodgeball requests to be sent to.

1. Register your custom subdomain

Custom Subdomain Guidelines

Follow these guidelines for your subdomain:

  • The subdomain should ONLY be used for sending requests to Dodgeball.
  • The subdomain’s primary domain should be the same as the request origin (e.g.: safety.mydomain.com where mydomain.com hosts the application using Dodgeball).
  • Do not use dodgeball.mydomain.com or db.mydomain.com as your subdomain. Instead, use a subdomain like safety.mydomain.com or a random subdomain like a1xt.mydomain.com. This will make it harder for ad blockers to detect and disable the package from loading. The general rule is the more random the subdomain, the better.

Adding DNS Records

Add a CNAME record to your DNS provider that points your custom subdomain to Dodgeball's servers. For the standard production environment, this is api.dodgeballhq.com.

Using a Sandbox or Single Tenant Environment

If you have a Sandbox or Single Tenant environment you would like to use, you'll need to point to the correct domain for that environment. After you login to your account, you can find the correct domain to use in the Developer Center on the API Keys tab. Be sure to omit the protocol (e.g.: https://) from the domain when adding the CNAME record.

For example, a CNAME record for a Sandbox environment would look like this:

TypeNameContent
CNAMEsafety.mysandboxdomain.comapi.sandbox.dodgeballhq.com

2. Update your Dodgeball Client SDK

The Dodgeball Client SDK accepts an apiUrl option as part of the optional config object passed to its constructor. By default, the Dodgeball Client SDK makes requests to https://api.dodgeballhq.com.

After you have registered your custom subdomain, you'll need to specify the apiUrl when using the Dodgeball Client SDK:

import { Dodgeball } from "@dodgeball/trust-sdk-client";

const dodgeball = new Dodgeball('public-api-key...', {
apiUrl: 'https://safety.mydomain.com'
});