Custom Endpoints
Proxy Mobana through your own domain for cleaner URLs and ad-blocker bypass.
Why Use Custom Endpoints?#
- Cleaner campaign URLs:
yourdomain.com/d/redirectlooks better thana1b2c3d4.mobana.ai/redirect - Ad-blocker bypass: Some ad blockers block third-party attribution domains. Your own domain is less likely to be blocked.
- Easier migration: If you ever switch attribution providers, your campaign URLs don't change.
- Brand consistency: Keep all URLs under your brand's domain.
How It Works#
- Set up a reverse proxy on your domain (e.g.,
yourdomain.com/d/*) - The proxy forwards requests to
YOUR_APP_ID.mobana.ai - Configure the SDK to use your custom endpoint
- Use your custom URL in campaign links
Proxy Configuration#
Nginx
# Nginx configuration
# Proxy /d/* to Mobana API
location /d/ {
proxy_pass https://YOUR_APP_ID.mobana.ai/;
proxy_set_header Host YOUR_APP_ID.mobana.ai;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_server_name on;
}Cloudflare Workers
// Cloudflare Worker
// Deploy at yourdomain.com/d/*
export default {
async fetch(request, env) {
const url = new URL(request.url);
// Rewrite to Mobana
const targetUrl = new URL(url.pathname.replace('/d', ''), 'https://YOUR_APP_ID.mobana.ai');
targetUrl.search = url.search;
// Forward the request
const response = await fetch(targetUrl.toString(), {
method: request.method,
headers: {
...Object.fromEntries(request.headers),
'Host': 'YOUR_APP_ID.mobana.ai',
'X-Forwarded-For': request.headers.get('CF-Connecting-IP'),
},
body: request.method !== 'GET' ? request.body : undefined,
});
return response;
},
};Vercel
// vercel.json
{
"rewrites": [
{
"source": "/d/:path*",
"destination": "https://YOUR_APP_ID.mobana.ai/:path*"
}
]
}Make sure your proxy forwards the client's real IP address via X-Forwarded-For or X-Real-IP headers. This is critical for probabilistic attribution matching.
SDK Configuration#
Tell the SDK to use your custom endpoint:
// In your React Native app
await Mobana.init({
appId: 'YOUR_APP_ID',
endpoint: 'https://yourdomain.com/d', // Your custom endpoint
});Campaign URLs#
Use your custom domain in campaign links:
# Campaign URL using your custom domain
https://yourdomain.com/d/redirect
?utm_source=facebook
&utm_campaign=summer_sale
&data={"promo":"SUMMER20"}Testing Your Setup#
Use the diagnostic endpoint to verify your proxy configuration:
curl https://yourdomain.com/d/ping
# Should return:
# {
# "ok": true,
# "appId": "YOUR_APP_ID",
# "appValid": true,
# "clientIp": "your.ip.address"
# }You can also test from the Dashboard: go to App Settings → Test Endpoint and enter your custom URL.
Troubleshooting#
IP Address Shows Proxy IP
If /ping shows your proxy server's IP instead of the client's IP, ensure you're forwarding the X-Forwarded-For or X-Real-IP header.
SSL/TLS Errors
Ensure your proxy supports TLS 1.2+ and has a valid SSL certificate.
CORS Errors
The Mobana API handles CORS automatically. If you see CORS errors, check that your proxy isn't modifying or stripping CORS headers.