Skip to content

Commit

Permalink
Merge branch 'AppMetrica'
Browse files Browse the repository at this point in the history
* AppMetrica:
  Updated RN snippet
  • Loading branch information
Lutik-sun committed Nov 5, 2024
2 parents bccb72e + 564d10d commit ae940f6
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions versioned_docs/version-3.0/appmetrica.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,27 @@ Adapty.UpdateProfile(builder.Build(), (error) => {
<TabItem value="RN" label="React Native (TS)" default>
```typescript
import { adapty } from 'react-native-adapty';
import AppMetrica, { DEVICE_ID_KEY, StartupParams, StartupParamsReason } from '@appmetrica/react-native-analytics';

// ...
try {
await adapty.updateProfile({
appmetricaProfileId: appmetricaProfileId,
appmetricaDeviceId: appmetricaDeviceId,
});
} catch (error) {
// handle `AdaptyError`
const startupParamsCallback = async (
params?: StartupParams,
reason?: StartupParamsReason
) => {
const deviceId = params?.deviceId
if (deviceId) {
try {
await adapty.updateProfile({
appmetricaProfileId: 'YOUR_ADAPTY_CUSTOMER_USER_ID',
appmetricaDeviceId: deviceId,
});
} catch (error) {
// handle `AdaptyError`
}
}
}

AppMetrica.requestStartupParams(startupParamsCallback, [DEVICE_ID_KEY])
```
</TabItem>
</Tabs>

0 comments on commit ae940f6

Please sign in to comment.