For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.
Proxy Analytics SDK requests
이 페이지는 아직 귀하의 언어로 번역되지 않았습니다. 현재 작업 중이므로 곧 다시 확인해 주십시오.
Route Analytics SDK requests through your own server when you need traffic to pass through your domain before reaching Amplitude. For Session Replay ingestion and configuration endpoints, use Proxy Session Replay requests.
Configure the proxy
- Accept SDK requests at your custom URL.
- Forward the full request body and all headers except
Hostto the corresponding Amplitude endpoint. - Return Amplitude's status code, headers, and response body unchanged.
Don't strip, modify, or buffer the request or response payload. The SDK handles retries. If you need an Authorization header for a downstream service, inject it in the proxy to keep credentials out of client-side code.
Configure the Analytics SDK
Applies to: Browser SDK, Android (Kotlin) SDK, iOS (Swift) SDK, React Native SDK, Node.js SDK, Python SDK, Go SDK.
Use the serverUrl configuration option to point the SDK at your proxy:
amplitude.init('API_KEY', {
serverUrl: 'https://analytics.yourdomain.com/2/httpapi'
});
Your proxy should forward requests to the appropriate Amplitude endpoint:
| Region | Default endpoint |
|---|---|
| US | https://api2.amplitude.com/2/httpapi |
| EU | https://api.eu.amplitude.com/2/httpapi |
| US (batch) | https://api2.amplitude.com/batch |
| EU (batch) | https://api.eu.amplitude.com/batch |
Use the batch endpoints for high-volume environments. To enable batch mode, set useBatch: true on the SDK and point serverUrl at your proxy path that forwards to the batch endpoint:
amplitude.init('API_KEY', {
useBatch: true,
serverUrl: 'https://analytics.yourdomain.com/batch'
});
Remote config proxy (Browser SDK 2 only)
Browser SDK 2 fetches remote configuration separately. To proxy those requests as well, use the remoteConfig.serverUrl option:
amplitude.init('API_KEY', {
serverUrl: 'https://analytics.yourdomain.com/2/httpapi',
remoteConfig: {
serverUrl: 'https://analytics.yourdomain.com/config'
}
});
이 내용이 도움이 되었나요?