Skip to main content

First Party Domain Integration

Recommended for web integrations

First-party domain integration using CNAME records provides limited performance benefits for the mobile SDKs due to current ad and content-blocking practices.

Rokt recommends using a first-party domain when integrating the Web SDK into your site. This integration uses a client-specific domain alias for Rokt endpoints, ensuring a seamless, first-party experience for customers and minimizing the risk of content being blocked.

Prerequisites

Before starting, ensure that:

  • Your technology team has access to your DNS settings and can create a CNAME record and a TXT record.
  • Your website allows web requests to first-party subdomains.

1. Choose a subdomain

Select a subdomain from which the Rokt SDK will be loaded. For example: rkt.yourcompany.com

Avoid including "Rokt" or advertising-related keywords like "Ads" or "Offers", since this may lead to your placements from being blocked. Once you've decided on a subdomain to use, share it with your Rokt account representative.

2. Rokt creates your SSL certificate

This step is handled by Rokt. You don't need to take any action until the next step.

Your dedicated Rokt team will handle the SSL certificate issuance after receiving your subdomain. They will then provide you with a unique token required for creating the TXT record and the CNAME target domain in the next step.

3. Create your DNS records

After you receive the unique token and CNAME target domain from your Rokt team, update your DNS settings as follows:

  1. Create a TXT record for SSL validation.

    • This allows Rokt to validate the SSL certificate for your subdomain
    • Please note that the unique token expires after 5 days

    Example TXT Record

    Type: TXT
    Name: _acme-challenge.rkt.yourcompany.com.
    Target: {token_provided_by_Rokt}
    TTL: 600 seconds
  2. Create a CNAME record.

    • Your CNAME record will redirect requests sent to the subdomain you specify to Rokt. Example CNAME Record
    Type: CNAME
    Name: rkt (the subdomain part of your full URL)
    Target: rkt.yourcompany.com.akamaized.net (provided by Rokt)
    TTL: 600 seconds
  3. Notify your Rokt team once you've created a TXT and CNAME record.

4. Update your SDK initialization script

After your dedicated Rokt team has validated that your TXT and CNAME records are working, update your SDK initialization script to refer to your new chosen subdomain. In your initialization script, look for the line where DOMAIN is specified:

const DOMAIN = "https://apps.rokt-api.com";

Change the value from Rokt's domain to your own:

const DOMAIN = "https://rkt.yourcompany.com";

Finally, alert Rokt once you've updated the domain setting in your script so they can ensure that the SDK automatically initializes using your new domain.

Was this article helpful?