Custom Domains
Use Fathom's custom domains feature to bypass ad blockers and improve tracking accuracy.
What Are Custom Domains?
Fathom's custom domains let you serve the tracking script from your own domain (e.g., stats.yourdomain.com). This helps avoid ad blockers that target cdn.usefathom.com.
Setup in Fathom
- Go to your Fathom dashboard
- Navigate to Settings → Custom Domains
- Add your custom domain (e.g.,
stats.yourdomain.com) - Configure DNS as instructed
- Wait for SSL certificate provisioning
Using Custom Domains
React / Next.js
Pass the custom domain in clientOptions:
tsx
<FathomProvider
siteId="YOUR_SITE_ID"
clientOptions={{
src: 'https://stats.yourdomain.com/script.js',
}}
>React Native
Use the scriptDomain prop:
tsx
<NativeFathomProvider siteId="YOUR_SITE_ID" scriptDomain="stats.yourdomain.com">
<App />
</NativeFathomProvider>Or with manual WebView setup:
tsx
<FathomWebView
ref={webViewRef}
siteId="YOUR_SITE_ID"
scriptDomain="stats.yourdomain.com"
onReady={handleReady}
/>Verifying Setup
Check Script Loading
Open your browser's Network tab and verify the Fathom script loads from your custom domain:
https://stats.yourdomain.com/script.jsCheck Tracking Requests
Tracking requests should also go to your custom domain:
https://stats.yourdomain.com/...Troubleshooting
Script Not Loading
- Verify DNS is configured correctly
- Check SSL certificate is active in Fathom dashboard
- Ensure the domain matches exactly (no trailing slash)
CORS Errors
Custom domains handle CORS automatically. If you see CORS errors:
- Verify the custom domain is fully provisioned
- Check you're using HTTPS
- Clear browser cache
React Native Not Working
Ensure the WebView can access your custom domain:
- Check network connectivity
- Verify no firewall blocking the domain
- Use
debug={true}to see detailed logs
tsx
<NativeFathomProvider
siteId="YOUR_SITE_ID"
scriptDomain="stats.yourdomain.com"
debug={true}
onError={(err) => console.error('Load error:', err)}
>Multiple Environments
Use environment variables to switch domains:
tsx
// React / Next.js
<FathomProvider
siteId={process.env.NEXT_PUBLIC_FATHOM_SITE_ID}
clientOptions={{
src: process.env.NEXT_PUBLIC_FATHOM_SCRIPT_URL,
}}
>bash
# .env.local
NEXT_PUBLIC_FATHOM_SITE_ID=ABCD1234
NEXT_PUBLIC_FATHOM_SCRIPT_URL=https://stats.yourdomain.com/script.jstsx
// React Native
<NativeFathomProvider
siteId={Config.FATHOM_SITE_ID}
scriptDomain={Config.FATHOM_CUSTOM_DOMAIN}
>Last updated: October 8, 2026