Follow the steps below to set up a custom tracking domain (CTD) for multi tenant instances. For more information about how it works see [_custom tracking domain (CTD)_](🔗) article.



This feature is still in BETA and therefore does not fall under SLA.

## 1. Prepare your subdomain

Prepare a subdomain of your website e.g. “analytics-api.yourdomain.com”. The selected subdomain should be dedicated entirely for this use, nothing existing should run there, not even on sub-sub domains e.g.. "something.analytics-api.yourdomain.com".



Setting DNS records on an incorrect domain that is used for other purposes can have serious consequences.

## 2. Add your subdomain in Project settings

Go to Project settings -> General -> General project settings as seen in the picture below



Enter your subdomain (or multiple subdomains, if you are tracking multiple domains in a single project); and save the settings. After saving the subdomain we will generate the NS DNS records to be set for your subdomain. This will not impact your existing tracking.



## 3. Set the DNS records

Set the NS DNS records for your subdomain as instructed in the Project settings. The NS DNS records might differ for every entered subdomain, make sure you set it correctly. There are commonly 4 records to be set.

NS Example:

Your SubdomainRecord TypeDestination DomainTTL
analytics-api.yourdomain.comNSns-cloud-d1.googledomains.com21600

**CNAME records** Custom tracking domain can be also set up using CNAME DNS records, but will not work to ensure persistent cookies and anonymous identity. We recommend using NS DNS records. If you wish to use CNAME records the destination domain can be found in the Project settings. CNAME destination domain is the same for every subdomain.



Your SubdomainRecord TypeDestination DomainTTL
analytics-api.yourdomain.comCNAMEcustom-api.exponea.com86400

## 4. Review DNS were created correctly

Once you have your DNS records configured, come back to the Project settings -> General -> General project settings. You will see a confirmation message in case the DNS records are set correctly. Be aware it may take a while till the DNS records are propagated and available for validation. If you set your records and you still dont see the confirmation, try coming back in 24 hours. If you still don’t see any confirmations, the records might not be set correctly.

We will also issue an SSL certificate for your subdomain and it may also take a while till this is processed. If you still see the error that the SSL certificate has not been issued after one day, please contact our support.



**CNAME records** In case you have used the CNAME records and they are set correctly, you will see the following confirmation.



## 5. Try to test load SDK

Try to test load our SDK from your new domain (you can do this via any browser) e.g analytics-api.yourdomain.com/js/exponea.min.js

## 6. Update and test the tracking snippet

There are up to three places where the snippet needs to be updated, based on the version of the web integration snippet you are using. You can update the snippet directly using the instructions below or look into the [Web Integration tab](🔗) where, once the CTD is set up, you can find the updated snippet. In case you have multiple custom domains in one project, follow the steps below.



When updating the snippet be careful to keep all your existing configuration of the initialization unchanged.

#### 1. Tracking API target

Add/Update the `"target"` parameter to your initialization config and set it to your custom domain e.g. `"target"` : `"https://analytics-api.yourdomain.com`



#### 2. JS SDK link

Look for the link to `exponea.min.js` in the initialization snippet and replace the JS SDK domain to your custom tracking domain. Example: Change from `//api.exponea.com/js/exponea.min.js` to `//analytics-api.yourdomain.com/js/exponea.min.js`



If you just see r.target+"/js/exponea.min.js" you have a newest version of the snippet and this stp is not needed.

#### 3. Non-flickering experiments API path

In case you are using [_non-flickering experiments_](🔗) update the “path” parameter in their initialization config and set it to your custom domain e.g. `webxpClient.path = https://analytics-api.yourdomain.com`



## 7. Make sure everything is working

Visit your website and make sure everything is working (events are being tracked, weblayers displayed…).

Cookies

You might also review the cookies and check the expiry when switching to your new domain, before doing so please make sure to read [how CTD works and which cookies are used](🔗).