From 1dd36daf813e68e21bf32aa91e08d2b2bd0020cb Mon Sep 17 00:00:00 2001 From: Raquel Diez Date: Tue, 3 Oct 2023 15:36:39 +0200 Subject: [PATCH 1/3] Add new reserved subscriber attribute and add deprecation note to --- .../subscriber-attributes.md" | 67 ++++++++++--------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git "a/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" "b/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" index 95306ab7..462aed73 100644 --- "a/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" +++ "b/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" @@ -78,39 +78,40 @@ Attribute keys beginning with `$` are reserved for RevenueCat. The current list ### General -| Key | Description | -| :----------------------- | :----------------------------------------------------------- | -| `$displayName` | Name that should be used to reference the user | -| `$apnsTokens` | Apple push notification tokens for the user. | -| `$fcmTokens` | Google push notification tokens for the user. | -| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | -| `$ipAddress` | Ip Address for the user. | -| `$clevertapId ` | Clever Tap ID for the user. | -| `$idfa` | iOS advertising identifier UUID. | -| `$idfv` | iOS vender identifier UUID. | -| `$gpsAdId` | The advertising ID that is provided by Google Play services. | -| `$androidId` | Android device identifier. | -| `$amazonAdId` | Amazon Advertising ID. | -| `$adjustId` | The unique Adjust identifier for the user. | -| `$amplitudeDeviceId` | The Amplitude Device ID. | -| `$amplitudeUserId` | The Amplitude User ID. | -| `$appsflyerId` | Appsflyer Id. The unique Appsflyer identifier for the user. | -| `$brazeAliasName` | The Braze 'alias_name' in User Alias Object. | -| `$brazeAliasLabel` | The Braze 'alias_label' in User Alias Object. | -| `$clevertapId` | The CleverTap ID for the user. | -| `$fbAnonId` | The Facebook Anonymous ID for the user. | -| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | -| `$mparticleId` | The unique mParticle user identifier (mpid). | -| `$onesignalId` | The OneSignal Player Id for the user. | -| `$airshipChannelId` | The Airship channel ID for the user. | -| `$iterableUserId` | The Iterable ID for the user. | -| `$iterableCampaignId` | The Iterable campaign ID. | -| `$iterableTemplateId` | The Iterable template ID. | -| `$firebaseAppInstanceId` | The Firebase instance identifier. | -| `$mixpanelDistinctId` | The Mixpanel user identifier. | -| `$ip` | The IP address of the device. | -| `$email` | Email address for the user. | -| `$phoneNumber` | Phone number for the user. | +| Key | Description | +|:-------------------------|:----------------------------------------------------------------------------------| +| `$displayName` | Name that should be used to reference the user | +| `$apnsTokens` | Apple push notification tokens for the user. | +| `$fcmTokens` | Google push notification tokens for the user. | +| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | +| `$ipAddress` | Ip Address for the user. | +| `$clevertapId ` | Clever Tap ID for the user. | +| `$idfa` | iOS advertising identifier UUID. | +| `$idfv` | iOS vender identifier UUID. | +| `$gpsAdId` | The advertising ID that is provided by Google Play services. | +| `$androidId` | Android device identifier. | +| `$amazonAdId` | Amazon Advertising ID. | +| `$adjustId` | The unique Adjust identifier for the user. | +| `$amplitudeDeviceId` | The Amplitude Device ID. | +| `$amplitudeUserId` | The Amplitude User ID. | +| `$appsflyerId` | Appsflyer Id. The unique Appsflyer identifier for the user. | +| `$brazeAliasName` | The Braze 'alias_name' in User Alias Object. | +| `$brazeAliasLabel` | The Braze 'alias_label' in User Alias Object. | +| `$clevertapId` | The CleverTap ID for the user. | +| `$fbAnonId` | The Facebook Anonymous ID for the user. | +| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | +| `$mparticleId` | The unique mParticle user identifier (mpid). | +| `$onesignalId` | The OneSignal Player Id for the user. Deprecated for OneSignal API versions >v9.0.| +| `$onesignalUserId` | The OneSignal Id (User Id) for the user. Use with OneSignal API versions >=v11.0. | +| `$airshipChannelId` | The Airship channel ID for the user. | +| `$iterableUserId` | The Iterable ID for the user. | +| `$iterableCampaignId` | The Iterable campaign ID. | +| `$iterableTemplateId` | The Iterable template ID. | +| `$firebaseAppInstanceId` | The Firebase instance identifier. | +| `$mixpanelDistinctId` | The Mixpanel user identifier. | +| `$ip` | The IP address of the device. | +| `$email` | Email address for the user. | +| `$phoneNumber` | Phone number for the user. | > 🚧 attConsentStatus is populated regardless of requesting any permission > From 8af99d710e259eb582b16c7187e5bfb3339e825e Mon Sep 17 00:00:00 2001 From: Raquel Diez Date: Tue, 3 Oct 2023 15:49:25 +0200 Subject: [PATCH 2/3] Attempt to fix linter --- .../subscriber-attributes.md" | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git "a/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" "b/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" index 462aed73..06bbbca2 100644 --- "a/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" +++ "b/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" @@ -78,40 +78,40 @@ Attribute keys beginning with `$` are reserved for RevenueCat. The current list ### General -| Key | Description | -|:-------------------------|:----------------------------------------------------------------------------------| -| `$displayName` | Name that should be used to reference the user | -| `$apnsTokens` | Apple push notification tokens for the user. | -| `$fcmTokens` | Google push notification tokens for the user. | -| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | -| `$ipAddress` | Ip Address for the user. | -| `$clevertapId ` | Clever Tap ID for the user. | -| `$idfa` | iOS advertising identifier UUID. | -| `$idfv` | iOS vender identifier UUID. | -| `$gpsAdId` | The advertising ID that is provided by Google Play services. | -| `$androidId` | Android device identifier. | -| `$amazonAdId` | Amazon Advertising ID. | -| `$adjustId` | The unique Adjust identifier for the user. | -| `$amplitudeDeviceId` | The Amplitude Device ID. | -| `$amplitudeUserId` | The Amplitude User ID. | -| `$appsflyerId` | Appsflyer Id. The unique Appsflyer identifier for the user. | -| `$brazeAliasName` | The Braze 'alias_name' in User Alias Object. | -| `$brazeAliasLabel` | The Braze 'alias_label' in User Alias Object. | -| `$clevertapId` | The CleverTap ID for the user. | -| `$fbAnonId` | The Facebook Anonymous ID for the user. | -| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | -| `$mparticleId` | The unique mParticle user identifier (mpid). | -| `$onesignalId` | The OneSignal Player Id for the user. Deprecated for OneSignal API versions >v9.0.| -| `$onesignalUserId` | The OneSignal Id (User Id) for the user. Use with OneSignal API versions >=v11.0. | -| `$airshipChannelId` | The Airship channel ID for the user. | -| `$iterableUserId` | The Iterable ID for the user. | -| `$iterableCampaignId` | The Iterable campaign ID. | -| `$iterableTemplateId` | The Iterable template ID. | -| `$firebaseAppInstanceId` | The Firebase instance identifier. | -| `$mixpanelDistinctId` | The Mixpanel user identifier. | -| `$ip` | The IP address of the device. | -| `$email` | Email address for the user. | -| `$phoneNumber` | Phone number for the user. | +| Key | Description | +|:-------------------------|:-----------------------------------------------------------------------------------| +| `$displayName` | Name that should be used to reference the user | +| `$apnsTokens` | Apple push notification tokens for the user. | +| `$fcmTokens` | Google push notification tokens for the user. | +| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | +| `$ipAddress` | Ip Address for the user. | +| `$clevertapId ` | Clever Tap ID for the user. | +| `$idfa` | iOS advertising identifier UUID. | +| `$idfv` | iOS vender identifier UUID. | +| `$gpsAdId` | The advertising ID that is provided by Google Play services. | +| `$androidId` | Android device identifier. | +| `$amazonAdId` | Amazon Advertising ID. | +| `$adjustId` | The unique Adjust identifier for the user. | +| `$amplitudeDeviceId` | The Amplitude Device ID. | +| `$amplitudeUserId` | The Amplitude User ID. | +| `$appsflyerId` | Appsflyer Id. The unique Appsflyer identifier for the user. | +| `$brazeAliasName` | The Braze 'alias_name' in User Alias Object. | +| `$brazeAliasLabel` | The Braze 'alias_label' in User Alias Object. | +| `$clevertapId` | The CleverTap ID for the user. | +| `$fbAnonId` | The Facebook Anonymous ID for the user. | +| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | +| `$mparticleId` | The unique mParticle user identifier (mpid). | +| `$onesignalId` | The OneSignal Player Id for the user. Deprecated for OneSignal API versions >v9.0. | +| `$onesignalUserId` | The OneSignal Id (User Id) for the user. Use with OneSignal API versions >=v11.0. | +| `$airshipChannelId` | The Airship channel ID for the user. | +| `$iterableUserId` | The Iterable ID for the user. | +| `$iterableCampaignId` | The Iterable campaign ID. | +| `$iterableTemplateId` | The Iterable template ID. | +| `$firebaseAppInstanceId` | The Firebase instance identifier. | +| `$mixpanelDistinctId` | The Mixpanel user identifier. | +| `$ip` | The IP address of the device. | +| `$email` | Email address for the user. | +| `$phoneNumber` | Phone number for the user. | > 🚧 attConsentStatus is populated regardless of requesting any permission > From 38386cb234327547d2d35853bef8f00c5a1fa443 Mon Sep 17 00:00:00 2001 From: Raquel Diez Date: Fri, 6 Oct 2023 16:18:52 +0200 Subject: [PATCH 3/3] Updated docs (WIP) --- .../onesignal_2.swift" | 32 +++++++++ .../subscriber-attributes.md" | 71 ++++++++++--------- .../third-party-integrations/onesignal.md" | 23 ++++++ 3 files changed, 91 insertions(+), 35 deletions(-) create mode 100644 "code_blocks/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal_2.swift" diff --git "a/code_blocks/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal_2.swift" "b/code_blocks/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal_2.swift" new file mode 100644 index 00000000..0787f7d9 --- /dev/null +++ "b/code_blocks/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal_2.swift" @@ -0,0 +1,32 @@ +class AppDelegate: UIResponder, UIApplicationDelegate, OSSubscriptionObserver { + + var window: UIWindow? + + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + + Purchases.configure(withAPIKey: "", appUserID: nil) + + OneSignal.initialize("", withLaunchOptions: launchOptions) + OneSignal.add(self as OSSubscriptionObserver) + + // If you've already set up OneSignal, then users should already have + // a OneSignal Id. We can check if it's available and send it to RevenueCat + if let onesignalUserId = OneSignal.User.onesignal_id { + Purchases.shared.attribution.setOnesignalUserID(onesignalUserId) + } + + return true + } + + // Add this method to update the $onesignalUserId in RevenueCat whenever it changes + // This code should be sufficient to capture all new users if you're setting + // up OneSignal for the first time. + func onOSSubscriptionChanged(_ stateChanges: OSSubscriptionStateChanges!) { + if !stateChanges.from.subscribed && stateChanges.to.subscribed { + // The user is subscribed + // Either the user subscribed for the first time + Purchases.shared.attribution.setOnesignalUserID(stateChanges.to.userId) + } + } +} diff --git "a/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" "b/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" index 06bbbca2..b4db99cc 100644 --- "a/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" +++ "b/docs_source/\360\237\221\245 Customers/subscriber-attributes.md" @@ -78,40 +78,40 @@ Attribute keys beginning with `$` are reserved for RevenueCat. The current list ### General -| Key | Description | -|:-------------------------|:-----------------------------------------------------------------------------------| -| `$displayName` | Name that should be used to reference the user | -| `$apnsTokens` | Apple push notification tokens for the user. | -| `$fcmTokens` | Google push notification tokens for the user. | -| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | -| `$ipAddress` | Ip Address for the user. | -| `$clevertapId ` | Clever Tap ID for the user. | -| `$idfa` | iOS advertising identifier UUID. | -| `$idfv` | iOS vender identifier UUID. | -| `$gpsAdId` | The advertising ID that is provided by Google Play services. | -| `$androidId` | Android device identifier. | -| `$amazonAdId` | Amazon Advertising ID. | -| `$adjustId` | The unique Adjust identifier for the user. | -| `$amplitudeDeviceId` | The Amplitude Device ID. | -| `$amplitudeUserId` | The Amplitude User ID. | -| `$appsflyerId` | Appsflyer Id. The unique Appsflyer identifier for the user. | -| `$brazeAliasName` | The Braze 'alias_name' in User Alias Object. | -| `$brazeAliasLabel` | The Braze 'alias_label' in User Alias Object. | -| `$clevertapId` | The CleverTap ID for the user. | -| `$fbAnonId` | The Facebook Anonymous ID for the user. | -| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | -| `$mparticleId` | The unique mParticle user identifier (mpid). | -| `$onesignalId` | The OneSignal Player Id for the user. Deprecated for OneSignal API versions >v9.0. | -| `$onesignalUserId` | The OneSignal Id (User Id) for the user. Use with OneSignal API versions >=v11.0. | -| `$airshipChannelId` | The Airship channel ID for the user. | -| `$iterableUserId` | The Iterable ID for the user. | -| `$iterableCampaignId` | The Iterable campaign ID. | -| `$iterableTemplateId` | The Iterable template ID. | -| `$firebaseAppInstanceId` | The Firebase instance identifier. | -| `$mixpanelDistinctId` | The Mixpanel user identifier. | -| `$ip` | The IP address of the device. | -| `$email` | Email address for the user. | -| `$phoneNumber` | Phone number for the user. | +| Key | Description | +|:-------------------------|:-------------------------------------------------------------------------------| +| `$displayName` | Name that should be used to reference the user | +| `$apnsTokens` | Apple push notification tokens for the user. | +| `$fcmTokens` | Google push notification tokens for the user. | +| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | +| `$ipAddress` | Ip Address for the user. | +| `$clevertapId ` | Clever Tap ID for the user. | +| `$idfa` | iOS advertising identifier UUID. | +| `$idfv` | iOS vender identifier UUID. | +| `$gpsAdId` | The advertising ID that is provided by Google Play services. | +| `$androidId` | Android device identifier. | +| `$amazonAdId` | Amazon Advertising ID. | +| `$adjustId` | The unique Adjust identifier for the user. | +| `$amplitudeDeviceId` | The Amplitude Device ID. | +| `$amplitudeUserId` | The Amplitude User ID. | +| `$appsflyerId` | Appsflyer Id. The unique Appsflyer identifier for the user. | +| `$brazeAliasName` | The Braze 'alias_name' in User Alias Object. | +| `$brazeAliasLabel` | The Braze 'alias_label' in User Alias Object. | +| `$clevertapId` | The CleverTap ID for the user. | +| `$fbAnonId` | The Facebook Anonymous ID for the user. | +| `$attConsentStatus` | Apple App Tracking Transparency consent status for the user. | +| `$mparticleId` | The unique mParticle user identifier (mpid). | +| `$onesignalId` | The OneSignal Player Id for the user. Deprecated for OneSignal versions >v9.0. | +| `$onesignalUserId` | The OneSignal User Id for the user. Required with OneSignal versions >=v11.0. | +| `$airshipChannelId` | The Airship channel ID for the user. | +| `$iterableUserId` | The Iterable ID for the user. | +| `$iterableCampaignId` | The Iterable campaign ID. | +| `$iterableTemplateId` | The Iterable template ID. | +| `$firebaseAppInstanceId` | The Firebase instance identifier. | +| `$mixpanelDistinctId` | The Mixpanel user identifier. | +| `$ip` | The IP address of the device. | +| `$email` | Email address for the user. | +| `$phoneNumber` | Phone number for the user. | > 🚧 attConsentStatus is populated regardless of requesting any permission > @@ -143,7 +143,7 @@ Attribute keys beginning with `$` are reserved for RevenueCat. The current list ### Third-party Identifiers | Key | Description | -| :----------------------- | :-------------------------------------------------------------------------------------------- | +|:-------------------------|:----------------------------------------------------------------------------------------------| | `$adjustId` | [Adjust](https://www.adjust.com/) user identifier | | `$amplitudeDeviceId` | [Amplitude](https://amplitude.com/) device identifier | | `$amplitudeUserId` | [Amplitude](https://amplitude.com/) user identifier | @@ -154,6 +154,7 @@ Attribute keys beginning with `$` are reserved for RevenueCat. The current list | `$mixpanelDistinctId` | [Mixpanel](https://mixpanel.com) user identifier | | `$mparticleId` | [mParticle](https://www.mparticle.com/) user identifier | | `$onesignalId` | [OneSignal](https://onesignal.com/) player identifier | +| `$onesignalUserId` | [OneSignal](https://onesignal.com/) user identifier | | `$clevertapId` | [CleverTap](https://clevertap.com/) user identifier | | `$airshipChannelId` | [Airship](https://www.airship.com/) channel identifier | diff --git "a/docs_source/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal.md" "b/docs_source/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal.md" index 0b0dc0ba..df81ed39 100644 --- "a/docs_source/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal.md" +++ "b/docs_source/\360\237\224\214 Integrations & Events/third-party-integrations/onesignal.md" @@ -165,6 +165,8 @@ The OneSignal integration tracks the following events: # 1. Send device data to RevenueCat +## OneSignal API versions v9.0 and below (deprecated) + The OneSignal integration requires some device-specific data. RevenueCat will only update users in OneSignal if the below data has been added as [Subscriber Attributes](doc:subscriber-attributes) for the user. | Key | Description | Required | @@ -185,6 +187,27 @@ You can listen for changes to the OneSignal Id through their SDK, and send the v ] [/block] +## OneSignal API versions v11.0 and above + +The OneSignal integration requires some user-specific data. RevenueCat will only update users in OneSignal if the below data has been added as [Subscriber Attributes](doc:subscriber-attributes) for the user. + +| Key | Description | Required | +|:-------------------|:---------------------------------------------------------------------------------|:---------| +| `$onesignalUserId` | The [OneSignal ID](https://documentation.onesignal.com/docs/users) for the user. | ✅ | + +This property can be set manually, like any other [Subscriber Attributes](doc:subscriber-attributes), or through the helper method `setOnesignalUserID()`. + +You can listen for changes to the OneSignal User ID through their SDK, and send the value to RevenueCat. If you already have OneSignal set up, you should make sure that you're also sending the OneSignal ID for users that are updating to the latest version of your app. + +[block:file] +[ + { + "language": "swift", + "name": "", + "file": "code_blocks/🔌 Integrations & Events/third-party-integrations/onesignal_2.swift" + } +] +[/block] # 2. Send RevenueCat events into OneSignal