Skip to content

Commit

Permalink
Merge branch 'Amplitude'
Browse files Browse the repository at this point in the history
* Amplitude:
  minor fix
  version to review
  draft version
  • Loading branch information
Lutik-sun committed Nov 7, 2024
2 parents 20d792f + 6448e22 commit 635779a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 24 deletions.
63 changes: 41 additions & 22 deletions versioned_docs/version-3.0/amplitude.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ Adapty provides a complete set of data that lets you track [subscription events]

### How to set up Amplitude integration

To set up the integration with [Amplitude](https://amplitude.com/), go to [Integrations > Amplitude](https://app.adapty.io/integrations/amplitude) in the Adapty Dashboard, turn on a toggle from off to on, and fill out fields.
Within Adapty, you can set up separate flows for **production** and **test events** from the Apple or Stripe sandbox environment or Google test account.

- For production events, enter the **Production** API keys from the Amplitude dashboard, with a unique API key for each platform: iOS, Android, and Stripe.
- For test events, use the **Sandbox** fields as needed.

To set up the Amplitude integration:

1. Open [**Integrations** -> **Amplitude**](https://app.adapty.io/integrations/amplitude) in your Adapty Dashboard.

<Zoom>
<img src={require('./img/3b50552-CleanShot_2023-08-15_at_16.47.102x.webp').default}
Expand All @@ -30,34 +36,46 @@ To set up the integration with [Amplitude](https://amplitude.com/), go to [Integ
</Zoom>


2. Toggle on **Amplitude integration** to enable it.

3. Fill in the integration fields:

| Field | Description |
| ------------------------------------------ | ------------------------------------------------------------ |
| **Amplitude iOS/ Android/ Stripe API key** | Enter the Amplitude **API Key** for iOS/ Android/ Stripe into Adapty. Locate it under **Project settings** in Amplitude. For help, check [Amplitude docs](https://amplitude.com/docs/apis/authentication). Start with **Sandbox** keys for testing, then switch to **Production** keys after successful tests. |

You need to enter the **API Key** into Adapty. To find a token, go to your **Project settings** in Amplitude. In case you need help, refer to [official docs](https://amplitude.com/docs/apis/authentication).
<Zoom>
<img src={require('./img/2297782-CleanShot_2023-08-15_at_16.53.512x.webp').default}
style={{
border: '1px solid #727272', /* border width and color */
width: '700px', /* image width */
display: 'block', /* for alignment */
margin: '0 auto' /* center alignment */
}}
/>
</Zoom>

4. Optional settings for further customization:

<Zoom>
<img src={require('./img/2297782-CleanShot_2023-08-15_at_16.53.512x.webp').default}
style={{
border: '1px solid #727272', /* border width and color */
width: '700px', /* image width */
display: 'block', /* for alignment */
margin: '0 auto' /* center alignment */
}}
/>
</Zoom>

| Parameter | Description |
| --------------------------------------- | ------------------------------------------------------------ |
| **How the revenue data should be sent** | Choose whether to send gross revenue or revenue after taxes and commissions. See [Store commission and taxes](controls-filters-grouping-compare-proceeds#store-commission-and-taxes) for details. |
| **Exclude historical events** | Choose to exclude events before Adapty SDK installation, preventing duplicate data. For example, if a user subscribed on January 10th but installed the Adapty SDK on March 6th, Adapty will only send events from March 6th onward. |
| **Send User Attributes** | Select this option to send user-specific attributes like language preferences. |
| **Always populate user_id** | Adapty automatically sends `device_id` as `amplitudeDeviceId`. For `user_id`, this setting defines behavior: <ul><li>**ON**: Sends Adapty `profile_id` if `amplitudeUserId` or `customer_user_id` aren’t available.</li><li>**OFF**: Leaves `user_id` empty if neither ID is available.</li></ul> |

5. Choose the events you want to receive and [map their names](amplitude#events-and-tags).

6. Click **Save** to confirm your changes.

Note: Once you click **Save**, Adapty will start sending events to Amplitude.

Along with events, Adapty also sends the[ subscription status](subscription-status) and subscription product ID to the [Amplitude user properties.](https://help.amplitude.com/hc/en-us/articles/115002380567#h_39e46c92-7b7f-4358-a96f-c82cc3342e3e)
In addition to events, Adapty sends [subscription status](subscription-status) and the subscription product ID to [Amplitude user properties](https://help.amplitude.com/hc/en-us/articles/115002380567#h_39e46c92-7b7f-4358-a96f-c82cc3342e3e).

### Events and tags

Below the credentials, there are three groups of events you can send to Amplitude from Adapty. Simply turn on the ones you need. Check the full list of the events offered by Adapty [here](events).


<Zoom>
<img src={require('./img/da67694-CleanShot_2023-08-15_at_16.52.352x.webp').default}
style={{
Expand All @@ -69,15 +87,16 @@ Below the credentials, there are three groups of events you can send to Amplitud
/>
</Zoom>





We recommend using the default event names provided by Adapty. But you can change the event names based on your needs. Adapty will send subscription events to Amplitude using a server-to-server integration, allowing you to view all subscription events in your Amplitude dashboard.

### SDK configuration

Use `Adapty.updateProfile()` method to set `amplitudeDeviceId` or `amplitudeUserId`. If not set, Adapty uses your user ID (`customerUserId`) or if it's null Adapty ID. Make sure that the user id you use to send data to Amplitude from your app is the same one you send to Adapty.
Use the `Adapty.updateProfile()` method to set either `amplitudeDeviceId` or `amplitudeUserId`. If neither is set, Adapty will default to using your user ID (`customerUserId`). If `customerUserId` is also absent, Adapty will handle `user_id` based on the **Always populate user_id** checkbox:

- **If selected**, Adapty will set `user_id` to the Adapty `profile_id`.
- **If cleared**, `user_id` will not be set.

Make sure that any user ID you use to send data to Amplitude from your app matches the one you send to Adapty.

<Tabs>
<TabItem value="Swift" label="iOS (Swift)" default>
Expand All @@ -95,8 +114,8 @@ Adapty.updateProfile(params: builder.build())
```kotlin
//for Amplitude maintenance SDK (obsolete)
val amplitude = Amplitude.getInstance()
val amplitudeDeviceId = amplitude.deviceId
val amplitudeUserId = amplitude.userId
val amplitudeDeviceId = amplitude.getDeviceId()
val amplitudeUserId = amplitude.getUserId()

//for actual Amplitude Kotlin SDK
val amplitude = Amplitude(
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-3.0/analytics-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Let us know! [Write to the Adapty support](mailto:[email protected]) and we'll c

### Setting the profile's identifier

Set the profile's identifier for the selected analytics using [`.updateProfile()`](setting-user-attributes#setting-user-attributes) method. For example, for Amplitude integration, you can set either `amplitudeUserId` or `amplitudeDeviceId`. For Mixpanel integration, you have to set `mixpanelUserId`. When these identifiers are not set, Adapty will use `customerUserId` instead. If the `customerUserId` is not set, we will use our internal profile id.
Set the profile's identifier for the selected analytics using [`.updateProfile()`](setting-user-attributes#setting-user-attributes) method. For example, for Amplitude integration, you can set either `amplitudeUserId` or `amplitudeDeviceId`. For Mixpanel integration, you have to set `mixpanelUserId`. When these identifiers are not set, Adapty will use `customerUserId` instead. If the `customerUserId` is not set, we will use our internal profile ID.

:::warning
Avoiding duplication
Expand Down
4 changes: 3 additions & 1 deletion versioned_docs/version-3.0/appmetrica.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ We recommend using the default event names provided by Adapty. But you can chang

## SDK configuration

Use `Adapty.updateProfile()` method to set `appmetricaProfileId` or `appmetricaDeviceId`. If not set, Adapty uses your user ID (`customerUserId`). Make sure that the user id you use to send data to AppMetrica from your app is the same one you send to Adapty. These links should help to set up a user id for AppMetrica in your app.
Use the `Adapty.updateProfile()` method to set the `appmetricaProfileId` or `appmetricaDeviceId` parameter. Setting `appmetricaDeviceId` is preferred!

If these aren’t set, Adapty will default to using your user ID (`customerUserId`). Make sure the user ID you use to send data to AppMetrica from your app matches the one you send to Adapty. These links can help you set up a user ID for AppMetrica in your app.

- [Set profile ID](https://appmetrica.yandex.com/docs/mobile-sdk-dg/ios/objective-c/ref/YMMYandexMetrica.html#method_detail__method_setUserProfileID) iOS;
- [Get device ID](https://appmetrica.yandex.ru/docs/ru/sdk/react-native/analytics/methods#appmetrica) iOS;
Expand Down

0 comments on commit 635779a

Please sign in to comment.