Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ mixpanel.init();

Once you've called this method once, you can access `mixpanel` throughout the rest of your application.

> [!IMPORTANT]
> If your project uses [EU](https://docs.mixpanel.com/docs/privacy/eu-residency) or [India](https://docs.mixpanel.com/docs/privacy/in-residency) data residency, pass your region's server URL as the third argument to `init()` (or call `setServerURL()` later). Mixpanel won't ingest events sent to the wrong region. Use one of:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Regional URL gets overwritten

In JavaScript mode, calling setServerURL() directly after the shown unawaited mixpanel.init() sets the regional URL, but initialize() overwrites it with the default US URL after its storage waits finish. Events then go to the wrong region. Remove this alternative or show await mixpanel.init() before setServerURL().

Suggested change
> If your project uses [EU](https://docs.mixpanel.com/docs/privacy/eu-residency) or [India](https://docs.mixpanel.com/docs/privacy/in-residency) data residency, pass your region's server URL as the third argument to `init()` (or call `setServerURL()` later). Mixpanel won't ingest events sent to the wrong region. Use one of:
> If your project uses [EU](https://docs.mixpanel.com/docs/privacy/eu-residency) or [India](https://docs.mixpanel.com/docs/privacy/in-residency) data residency, pass your region's server URL as the third argument to `init()`. Mixpanel won't ingest events sent to the wrong region. Use one of:

Knowledge Base Used: SDK initialization and configuration

Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 115

Comment:
**Regional URL gets overwritten**

In JavaScript mode, calling `setServerURL()` directly after the shown unawaited `mixpanel.init()` sets the regional URL, but `initialize()` overwrites it with the default US URL after its storage waits finish. Events then go to the wrong region. Remove this alternative or show `await mixpanel.init()` before `setServerURL()`.

```suggestion
> If your project uses [EU](https://docs.mixpanel.com/docs/privacy/eu-residency) or [India](https://docs.mixpanel.com/docs/privacy/in-residency) data residency, pass your region's server URL as the third argument to `init()`. Mixpanel won't ingest events sent to the wrong region. Use one of:
```

**Knowledge Base Used:** [SDK initialization and configuration](https://app.greptile.com/-/switch-tenant?tenant=mixpanel&next=%2Fcustom-context%2Fknowledge-base%2Fmixpanel%2Fmixpanel-react-native%2F-%2Fdocs%2Fsdk-initialization-and-configuration.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

>
> ```js
> mixpanel.init(false, {}, "https://api-eu.mixpanel.com"); // EU
> ```
>
> ```js
> mixpanel.init(false, {}, "https://api-in.mixpanel.com"); // India
> ```

### 3. Send Data

Let's get started by sending event data. You can send an event from anywhere in your application. Better understand user behavior by storing details that are specific to the event (properties). After initializing the library, Mixpanel will automatically track some properties by default. [learn more](https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel)
Expand Down
Loading