Custom domains
Use a custom domain when your Surface forms are served from a verified domain such as forms.example.com. One verified domain can serve several forms: a root form at the domain root and additional linked forms at /s/ paths. The Surface Tag uses that domain for form communication, visitor identification, journey tracking, external-form events, and open triggers.
Before you begin
You need access to:
- Your Surface environment settings
- Your DNS provider
- Your website's global
<head>code
Only use a domain that is verified in Surface and controlled by your organization.
1. Add and verify your domain
- In Surface, go to Settings → Domains.
- Click Add domain and enter the subdomain you want to use.
- Add the CNAME record and, when shown, the TXT verification record to your DNS provider.
- Wait for the DNS changes to propagate.
- Return to Settings → Domains and click Verify.
Continue once the domain shows a green Live status.
2. Connect your forms to the domain
A verified domain serves one root form at the domain root and any number of linked forms at /s/ paths:
- Root form →
https://forms.example.com/ - Linked form →
https://forms.example.com/s/<formId>
Each form lives on one domain at a time. You can manage the forms on a domain from the Domains tab, or set the domain on each form individually.
Manage forms from the domains tab
In Settings → Domains, each verified domain shows its root form and how many forms are linked. Click Manage forms to add, remove, or reorganize them.
The Manage forms dialog lists every form on the domain with its live URL. Use Add a form to this domain to link another form, and each row's menu to copy its URL, make it the root, or remove it from the domain.
Set the domain from a form
You can also connect a form from the form itself. Open the form, go to Settings → Custom Domain, choose the verified domain, then pick where it is served:
- The domain root ,
https://forms.example.com/ - A path on the domain ,
https://forms.example.com/s/<formId>
Select None to disconnect the form from the domain.
Use the custom-domain URL shown here when embedding or sharing each form.
3. Update the Surface tag
Add data-custom-domain to the Surface Tag in your website's <head>:
<!-- Start Surface Tag -->
<script
src="https://cdn.jsdelivr.net/gh/trysurface/scripts@latest/surface_tag.min.js"
site-id="YOUR_SITE_ID"
data-custom-domain="forms.example.com">
</script>
<!-- End Surface Tag -->
Replace YOUR_SITE_ID with the Site ID from Settings → Overview, and replace forms.example.com with the exact verified domain shown in Surface. One data-custom-domain value covers every form on that domain, root and linked alike.
Using a cookie banner? Keep data-custom-domain and add data-consent-mode to the same tag, then follow the cookie consent setup guide to connect your banner's choices.
We recommend entering the hostname without https://. An HTTPS origin such as https://forms.example.com also works.
4. Optimize loading
If you use connection hints, point them at the custom domain instead of forms.withsurface.com:
<link rel="dns-prefetch" href="https://forms.example.com">
<link rel="preconnect" href="https://forms.example.com" crossorigin>
<link rel="prefetch" href="YOUR_CUSTOM_DOMAIN_FORM_URL" as="document">
Replace YOUR_CUSTOM_DOMAIN_FORM_URL with the full form URL generated by Surface.
5. Test the installation
- Publish the website changes.
- Open a page that contains the Surface Tag and a Surface form.
- Open and submit the form with test data.
- Confirm that the response appears in Surface.
If the form does not load or tracking is missing, confirm that:
- The domain status is Live in Surface.
- Each form you use is connected to that domain.
data-custom-domainexactly matches the verified hostname.- The form URL uses the same custom domain, at
/for the root form or/s/<formId>for a linked form.
To return to the default Surface domain, remove data-custom-domain from the Surface Tag and use the form URL generated for forms.withsurface.com.