Skip to content
Open
Show file tree
Hide file tree
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
248 changes: 248 additions & 0 deletions docs/quickstart/install-mixpanel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Already collect product data? Connect your [**Data Warehouse**](/docs/tracking-m

Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tracking-methods/choosing-the-right-method).

Mixpanel supports [EU](/docs/privacy/eu-residency) and [India](/docs/privacy/in-residency) data residency, which you choose per project. If your project uses either, point the SDK at that region's host. Each tab below shows how. Events sent to the wrong region aren't ingested.

{/* TABS */}

<Tabs>
Expand Down Expand Up @@ -60,6 +62,34 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
record_heatmap_data: true,
});
```

US projects use the SDK's default host and need no change. For an EU or India project, set `api_host`:

<CodeGroup>

```js EU
mixpanel.init("YOUR_TOKEN", {
api_host: "https://api-eu.mixpanel.com",
debug: true,
track_pageview: true,
persistence: "localStorage",
record_sessions_percent: 100, //records 100% of all sessions
record_heatmap_data: true,
});
Comment thread
greptile-apps[bot] marked this conversation as resolved.
```

```js India
mixpanel.init("YOUR_TOKEN", {
api_host: "https://api-in.mixpanel.com",
debug: true,
track_pageview: true,
persistence: "localStorage",
record_sessions_percent: 100, //records 100% of all sessions
record_heatmap_data: true,
});
```

</CodeGroup>
</Tab>
<Tab title="Python">
##### Install the SDK
Expand All @@ -77,6 +107,24 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr

mp = Mixpanel("YOUR_TOKEN")
```

US projects use the SDK's default host and need no change. For an EU or India project, pass a `Consumer` with `api_host` set:

<CodeGroup>

```python EU
from mixpanel import Mixpanel, Consumer

mp = Mixpanel("YOUR_TOKEN", consumer=Consumer(api_host="api-eu.mixpanel.com"))
```

```python India
from mixpanel import Mixpanel, Consumer

mp = Mixpanel("YOUR_TOKEN", consumer=Consumer(api_host="api-in.mixpanel.com"))
```

</CodeGroup>
</Tab>
<Tab title="PHP">
##### Install the SDK
Expand Down Expand Up @@ -112,6 +160,28 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr

?>
```

US projects use the SDK's default host and need no change. For an EU or India project, set the `host` option:

<CodeGroup>

```php EU
<?php
$mp = Mixpanel::getInstance("YOUR_TOKEN", array(
"host" => "api-eu.mixpanel.com"
));
?>
```

```php India
<?php
$mp = Mixpanel::getInstance("YOUR_TOKEN", array(
"host" => "api-in.mixpanel.com"
));
?>
```

</CodeGroup>
</Tab>
<Tab title="Node">
##### Install the SDK
Expand All @@ -131,6 +201,24 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
// Create an instance of the mixpanel client
var mixpanel = Mixpanel.init("YOUR_TOKEN");
```

US projects use the SDK's default host and need no change. For an EU or India project, set `host`:

<CodeGroup>

```js EU
var mixpanel = Mixpanel.init("YOUR_TOKEN", {
host: "api-eu.mixpanel.com",
});
```

```js India
var mixpanel = Mixpanel.init("YOUR_TOKEN", {
host: "api-in.mixpanel.com",
});
```

</CodeGroup>
</Tab>
<Tab title="Go">
##### Install the SDK
Expand All @@ -156,6 +244,20 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
mp := mixpanel.NewApiClient("YOUR_TOKEN")
}
```

US projects use the SDK's default host and need no change. For an EU or India project, pass the matching residency option:

<CodeGroup>

```go EU
mp := mixpanel.NewApiClient("YOUR_TOKEN", mixpanel.EuResidency())
```

```go India
mp := mixpanel.NewApiClient("YOUR_TOKEN", mixpanel.InResidency())
```

</CodeGroup>
</Tab>
<Tab title="Ruby">
##### Install the SDK
Expand All @@ -173,6 +275,36 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr

mp = Mixpanel::Tracker.new(YOUR_TOKEN)
```

US projects use the SDK's default host and need no change. For an EU or India project, send messages through a consumer that uses the regional host:

<CodeGroup>

```ruby EU
consumer = Mixpanel::Consumer.new(
'https://api-eu.mixpanel.com/track',
'https://api-eu.mixpanel.com/engage',
'https://api-eu.mixpanel.com/groups',
)

mp = Mixpanel::Tracker.new(YOUR_TOKEN) do |type, message|
consumer.send!(type, message)
end
```

```ruby India
consumer = Mixpanel::Consumer.new(
'https://api-in.mixpanel.com/track',
'https://api-in.mixpanel.com/engage',
'https://api-in.mixpanel.com/groups',
)

mp = Mixpanel::Tracker.new(YOUR_TOKEN) do |type, message|
consumer.send!(type, message)
end
```

</CodeGroup>
</Tab>
<Tab title="Java">
##### Install the SDK
Expand Down Expand Up @@ -200,6 +332,24 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr

MessageBuilder messageBuilder = new MessageBuilder('YOUR_TOKEN');
```

US projects use the SDK's default host and need no change. For an EU or India project, pass the regional endpoints to `MixpanelAPI`:

<CodeGroup>

```java EU
MixpanelAPI mixpanel = new MixpanelAPI("https://api-eu.mixpanel.com/track",
"https://api-eu.mixpanel.com/engage",
"https://api-eu.mixpanel.com/groups");
```

```java India
MixpanelAPI mixpanel = new MixpanelAPI("https://api-in.mixpanel.com/track",
"https://api-in.mixpanel.com/engage",
"https://api-in.mixpanel.com/groups");
```

</CodeGroup>
</Tab>
<Tab title="React Native">
##### Install the SDK
Expand Down Expand Up @@ -231,6 +381,20 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
const mixpanel = new Mixpanel("YOUR_TOKEN", trackAutomaticEvents);
mixpanel.init();
```

US projects use the SDK's default host and need no change. For an EU or India project, pass the regional host as the third argument to `init()`:

<CodeGroup>

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

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

</CodeGroup>
</Tab>
<Tab title="Flutter">
##### Install the SDK
Expand Down Expand Up @@ -262,6 +426,28 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
}
}
```

US projects use the SDK's default host and need no change. For an EU or India project, pass `serverURL`:

<CodeGroup>

```dart EU
mixpanel = await Mixpanel.init(
"YOUR_TOKEN",
trackAutomaticEvents: false,
serverURL: "https://api-eu.mixpanel.com",
);
```

```dart India
mixpanel = await Mixpanel.init(
"YOUR_TOKEN",
trackAutomaticEvents: false,
serverURL: "https://api-in.mixpanel.com",
);
```

</CodeGroup>
</Tab>
<Tab title="iOS (Objective-C)">
##### Install the SDK
Expand Down Expand Up @@ -294,6 +480,20 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
...
}
```

US projects use the SDK's default host and need no change. For an EU or India project, set `serverURL` after initialization:

<CodeGroup>

```objc EU
mixpanel.serverURL = @"https://api-eu.mixpanel.com";
```

```objc India
mixpanel.serverURL = @"https://api-in.mixpanel.com";
```

</CodeGroup>
</Tab>
<Tab title="iOS (Swift)">
##### Install the SDK
Expand Down Expand Up @@ -332,6 +532,28 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
...
}
```

US projects use the SDK's default host and need no change. For an EU or India project, set `serverURL` in `MixpanelOptions`:

<CodeGroup>

```swift EU
let options = MixpanelOptions(
token: "YOUR_TOKEN",
serverURL: "https://api-eu.mixpanel.com"
)
Mixpanel.initialize(options: options)
```

```swift India
let options = MixpanelOptions(
token: "YOUR_TOKEN",
serverURL: "https://api-in.mixpanel.com"
)
Mixpanel.initialize(options: options)
```

</CodeGroup>
</Tab>
<Tab title="Android">
##### Install the SDK
Expand Down Expand Up @@ -380,6 +602,28 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
}
}
```

US projects use the SDK's default host and need no change. For an EU or India project, set `serverURL` with `MixpanelOptions`:

<CodeGroup>

```java EU
MixpanelOptions options = new MixpanelOptions.Builder()
.serverURL("https://api-eu.mixpanel.com")
.build();

mp = MixpanelAPI.getInstance(this, "YOUR_TOKEN", trackAutomaticEvents, options);
```

```java India
MixpanelOptions options = new MixpanelOptions.Builder()
.serverURL("https://api-in.mixpanel.com")
.build();

mp = MixpanelAPI.getInstance(this, "YOUR_TOKEN", trackAutomaticEvents, options);
```

</CodeGroup>
</Tab>
<Tab title="Unity">
##### Install the SDK
Expand All @@ -396,6 +640,8 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
![unity\_screenshots](https://user-images.githubusercontent.com/36679208/152408022-62440f50-04c7-4ff3-b331-02d3d3122c9e.jpg)
</Frame>

US projects use the SDK's default host and need no change. For an EU or India project, set **API Host Address** in the same settings menu to `https://api-eu.mixpanel.com/` or `https://api-in.mixpanel.com/`.

Note: If you prefer to initialize Mixpanel manually, you can select the `Manual Initialization` in the settings and call `Mixpanel.Init()` to initialize.

To use mixpanel, add the following sample code to a part of your application:
Expand All @@ -414,6 +660,8 @@ Choose from the methods below. Not sure how to choose? [Read our guide](/docs/tr
</Note>

Using the HTTP API does not require an installation. **You're ready to move to the next step.**

For an EU or India project, send [Ingestion API](/reference/ingestion-api) requests to `api-eu.mixpanel.com` or `api-in.mixpanel.com` instead of `api.mixpanel.com`.
</Tab>
</Tabs>

Expand Down
2 changes: 1 addition & 1 deletion docs/tracking-methods/sdks/android.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class MainActivity extends ActionBarActivity {
### Library Configuration

<Warning>
For projects with EU or India data residency, you must configure the SDK to use the correct regional endpoint. Events sent to the wrong region will not be ingested. Learn more about [Privacy-Friendly Tracking](/docs/tracking-methods/sdks/android#privacy-friendly-tracking).
Mixpanel supports [EU](/docs/privacy/eu-residency) and [India](/docs/privacy/in-residency) data residency, which you choose per project. If your project uses either, set `serverURL` to `https://api-eu.mixpanel.com` or `https://api-in.mixpanel.com` on `MixpanelOptions.Builder` and pass the options to `getInstance()`. Events sent to the wrong region aren't ingested. See [EU Data Residency](#eu-data-residency) and [India Data Residency](#india-data-residency) for examples.
</Warning>

The library can be initialized with different configurations. See a complete list of the configuration options and methods under [`MPConfig`](https://mixpanel.github.io/mixpanel-android/com/mixpanel/android/mpmetrics/MPConfig.html).
Expand Down
2 changes: 1 addition & 1 deletion docs/tracking-methods/sdks/flutter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Add the following snippet to your `web/index.html` inside the `<head></head>` ta
### Library Configuration

<Warning>
For projects with EU or India data residency, you must configure the SDK to use the correct regional endpoint. Events sent to the wrong region will not be ingested. Learn more about [Privacy-Friendly Tracking](/docs/tracking-methods/sdks/flutter#privacy-friendly-tracking).
Mixpanel supports [EU](/docs/privacy/eu-residency) and [India](/docs/privacy/in-residency) data residency, which you choose per project. If your project uses either, pass `serverURL` set to `https://api-eu.mixpanel.com` or `https://api-in.mixpanel.com` to `Mixpanel.init()`. Events sent to the wrong region aren't ingested. See [EU Data Residency](#eu-data-residency) and [India Data Residency](#india-data-residency) for examples.
</Warning>

The Mixpanel instance can be customized with different configurations. The [`Mixpanel.init()`](https://mixpanel.github.io/mixpanel-flutter/mixpanel_flutter/Mixpanel/init.html) method accepts arguments that sets some configurations on your instance upon initialization.
Expand Down
2 changes: 1 addition & 1 deletion docs/tracking-methods/sdks/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mp := mixpanel.NewApiClient("YOUR_PROJECT_TOKEN")
### Library Configuration

<Warning>
For projects with EU or India data residency, you must configure the SDK to use the correct regional endpoint. Events sent to the wrong region will not be ingested. Learn more about [Privacy-Friendly Tracking](/docs/tracking-methods/sdks/go#privacy-friendly-tracking).
Mixpanel supports [EU](/docs/privacy/eu-residency) and [India](/docs/privacy/in-residency) data residency, which you choose per project. If your project uses either, pass `mixpanel.EuResidency()` or `mixpanel.InResidency()` to `NewApiClient()`. These options send requests to `api-eu.mixpanel.com` or `api-in.mixpanel.com`. Events sent to the wrong region aren't ingested. See [EU Data Residency](#eu-data-residency) and [India Data Residency](#in-data-residency) for examples.
</Warning>

The library can be initialized with different configurations. See a complete list of the configuration options[here](https://pkg.go.dev/github.com/mixpanel/mixpanel-go#Options).
Expand Down
Loading
Loading