Skip to content

Commit

Permalink
Merge pull request #14 from managed-components/eu
Browse files Browse the repository at this point in the history
ZRZ-1321 add support to eu endpoint
  • Loading branch information
ad-astra-via authored May 28, 2024
2 parents 72a00e4 + 9705b55 commit af3adb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ This Managed Component (MC) uses [Amplitude’s HTTP API v2](https://www.docs.de

`api_key` Used to pass your Amplitude's Project API key. See [Find your Amplitude Project API Credentials](https://www.docs.developers.amplitude.com/analytics/find-api-credentials/) for help locating your credentials.

#### EU Data Residency `boolean` _optional_

`eu_data` For EU data residency, the project must first be set up inside [Amplitude EU](https://analytics.eu.amplitude.com/signup). Toggle on this field to change the standard endpoint with the EU residency endpoint: `https://api.eu.amplitude.com/2/httpapi`.

#### Minimun Id Length `Integer`, _optional_

`min_id_length` Use this field to override the Device IDs and User IDs minimum length. For more information, see Amplitude's docs for [Options](https://www.docs.developers.amplitude.com/analytics/apis/http-v2-api/#options).
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ export default async function (manager: Manager, settings: ComponentSettings) {
events: [eventData],
}

const amplitudeEndpoint = 'https://api2.amplitude.com/2/httpapi'
manager.fetch(amplitudeEndpoint, {
const endpoint = settings.eu_data
? 'https://api.eu.amplitude.com/2/httpapi'
: 'https://api2.amplitude.com/2/httpapi'

manager.fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down

0 comments on commit af3adb6

Please sign in to comment.