ÿÿ Adapty Flutter SDK v3.3 ã¸ã®ç§»è¡Œ | Adapty ドキュメント

Adapty Flutter SDK ã‚’ v3.3 ã«ç§»è¡Œã™ã‚‹

Adapty SDK 3.3.0 ã¯ãƒ¡ã‚¸ãƒ£ãƒ¼ãƒªãƒªãƒ¼ã‚¹ã§ã‚りã€ã„ãã¤ã‹ã®æ”¹å–„ãŒåŠ ãˆã‚‰ã‚Œã¾ã—ãŸãŒã€ç§»è¡Œä½œæ¥­ãŒå¿…è¦ã«ãªã‚‹å ´åˆãŒã‚りã¾ã™ã€‚

  1. フォールãƒãƒƒã‚¯ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’æä¾›ã™ã‚‹ãƒ¡ã‚½ãƒƒãƒ‰ã‚’æ›´æ–°ã™ã‚‹ã€‚
  2. getProductsIntroductoryOfferEligibility メソッドを削除ã™ã‚‹ã€‚
  3. Adjustã€AirBridgeã€Amplitudeã€AppMetricaã€Appsflyerã€Branchã€Facebook Adsã€Firebase and Google Analyticsã€Mixpanelã€OneSignalã€Pushwoosh ã®ã‚¤ãƒ³ãƒ†ã‚°ãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³è¨­å®šã‚’æ›´æ–°ã™ã‚‹ã€‚
  4. Observer モードã®å®Ÿè£…ã‚’æ›´æ–°ã™ã‚‹ã€‚

フォールãƒãƒƒã‚¯ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’æä¾›ã™ã‚‹ãƒ¡ã‚½ãƒƒãƒ‰ã‚’æ›´æ–°ã™ã‚‹

以å‰ã¯ã€ãƒ¡ã‚½ãƒƒãƒ‰ã«ãƒ•ォールãƒãƒƒã‚¯ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’ JSON 文字列(jsonString)ã¨ã—ã¦æ¸¡ã—ã¦ã„ã¾ã—ãŸãŒã€ç¾åœ¨ã¯ãƒ­ãƒ¼ã‚«ãƒ«ã®ãƒ•ォールãƒãƒƒã‚¯ãƒ•ァイルã¸ã®ãƒ‘ス(assetId)を渡ã™ã‚ˆã†ã«å¤‰æ›´ã•れã¾ã—ãŸã€‚

 import 'dart:async' show Future;
 import 'dart:io' show Platform;
-import 'package:flutter/services.dart' show rootBundle;

-final filePath = Platform.isIOS ? 'assets/ios_fallback.json' : 'assets/android_fallback.json';
-final jsonString = await rootBundle.loadString(filePath);
+final assetId = Platform.isIOS ? 'assets/ios_fallback.json' : 'assets/android_fallback.json';

 try {
-  await adapty.setFallbackPaywalls(jsonString);
+  await adapty.setFallbackPaywalls(assetId);
 } on AdaptyError catch (adaptyError) {
   // handle the error
 } catch (e) {
 }

完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€ãƒ•ォールãƒãƒƒã‚¯ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’使用ã™ã‚‹ãƒšãƒ¼ã‚¸ã‚’ã”覧ãã ã•ã„。

getProductsIntroductoryOfferEligibility メソッドを削除ã™ã‚‹

Adapty iOS SDK 3.3.0 よりå‰ã¯ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ãŒé©æ ¼ã‹ã©ã†ã‹ã«é–¢ã‚らãšã€ãƒ—ロダクトオブジェクトã«ã¯å¸¸ã«ã‚ªãƒ•ァーãŒå«ã¾ã‚Œã¦ã„ã¾ã—ãŸã€‚ãã®ãŸã‚ã€ã‚ªãƒ•ァーを使用ã™ã‚‹å‰ã«é©æ ¼æ€§ã‚’手動ã§ç¢ºèªã™ã‚‹å¿…è¦ãŒã‚りã¾ã—ãŸã€‚

ç¾åœ¨ã¯ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ãŒé©æ ¼ãªå ´åˆã«ã®ã¿ãƒ—ロダクトオブジェクトã«ã‚ªãƒ•ァーãŒå«ã¾ã‚Œã¾ã™ã€‚ã¤ã¾ã‚Šã€é©æ ¼æ€§ã‚’確èªã™ã‚‹å¿…è¦ãŒãªããªã‚Šã¾ã—ãŸã€‚オファーãŒå­˜åœ¨ã—ã¦ã„れã°ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ã¯é©æ ¼ã§ã™ã€‚

サードパーティインテグレーション㮠SDK 設定を更新ã™ã‚‹

Adapty Flutter SDK 3.3.0 以é™ã§ã‚¤ãƒ³ãƒ†ã‚°ãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ãŒæ­£ã—ã動作ã™ã‚‹ã‚ˆã†ã€ä»¥ä¸‹ã®ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã«å¾“ã£ã¦å„インテグレーション㮠SDK 設定を更新ã—ã¦ãã ã•ã„。

Adjust

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Adjust インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。

 import 'package:adjust_sdk/adjust.dart';
 import 'package:adjust_sdk/adjust_config.dart';

 try {
   final adid = await Adjust.getAdid();

   if (adid == null) {
     // handle the error
   }

+   await Adapty().setIntegrationIdentifier(
+     key: "adjust_device_id", 
+     value: adid,
+   );

   final attributionData = await Adjust.getAttribution();

   var attribution = Map<String, String>();

   if (attributionData.trackerToken != null) attribution['trackerToken'] = attributionData.trackerToken!;
   if (attributionData.trackerName != null) attribution['trackerName'] = attributionData.trackerName!;
   if (attributionData.network != null) attribution['network'] = attributionData.network!;
   if (attributionData.adgroup != null) attribution['adgroup'] = attributionData.adgroup!;
   if (attributionData.creative != null) attribution['creative'] = attributionData.creative!;
   if (attributionData.clickLabel != null) attribution['clickLabel'] = attributionData.clickLabel!;
   if (attributionData.costType != null) attribution['costType'] = attributionData.costType!;
   if (attributionData.costAmount != null) attribution['costAmount'] = attributionData.costAmount!.toString();
   if (attributionData.costCurrency != null) attribution['costCurrency'] = attributionData.costCurrency!;
   if (attributionData.fbInstallReferrer != null) attribution['fbInstallReferrer'] = attributionData.fbInstallReferrer!;

-   Adapty().updateAttribution(
-     attribution,
-     source: AdaptyAttributionSource.adjust,
-     networkUserId: adid,
-   );
+   await Adapty().updateAttribution(attribution, source: "adjust");
 } catch (e) {
   // handle the error
   } on AdaptyError catch (adaptyError) {
   // handle the error
 }

AirBridge

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€AirBridge インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。

 import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';

  final deviceUUID = await Airbridge.state.deviceUUID;
  
  try {
-     final builder = AdaptyProfileParametersBuilder()
-         ..setAirbridgeDeviceId(deviceUUID);  
-     await Adapty().updateProfile(builder.build());

+     await Adapty().setIntegrationIdentifier(
+         key: "airbridge_device_id", 
+         value: deviceUUID,
+     );
  } on AdaptyError catch (adaptyError) {
     // handle the error
  } catch (e) {
     // handle the error
  }

Amplitude

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Amplitude インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。

 import 'package:amplitude_flutter/amplitude.dart';

 final Amplitude amplitude = Amplitude.getInstance(instanceName: "YOUR_INSTANCE_NAME");

 final deviceId = await amplitude.getDeviceId();
 final userId = await amplitude.getUserId();

 try {
-  final builder = AdaptyProfileParametersBuilder()
-     ..setAmplitudeDeviceId(deviceId)
-     ..setAmplitudeUserId(userId);
-     await adapty.updateProfile(builder.build());

+     await Adapty().setIntegrationIdentifier(
+         key: "amplitude_user_id", 
+         value: userId,
+     );
+     await Adapty().setIntegrationIdentifier(
+         key: "amplitude_device_id", 
+         value: deviceId,
+     );
  } on AdaptyError catch (adaptyError) {
      // handle the error
  } catch (e) {
      // handle the error
  }

AppMetrica

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€AppMetrica インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。

 import 'package:appmetrica_plugin/appmetrica_plugin.dart';

 final deviceId = await AppMetrica.deviceId;

 if (deviceId != null) {
   try {
-   final builder = AdaptyProfileParametersBuilder()
-     ..setAppmetricaDeviceId(deviceId)
-     ..setAppmetricaProfileId("YOUR_ADAPTY_CUSTOMER_USER_ID");
-
-     await adapty.updateProfile(builder.build());
   
+     await Adapty().setIntegrationIdentifier(
+         key: "appmetrica_device_id", 
+         value: deviceId,
+     );
+     await Adapty().setIntegrationIdentifier(
+         key: "appmetrica_profile_id", 
+         value: "YOUR_ADAPTY_CUSTOMER_USER_ID",
+     );
    } on AdaptyError catch (adaptyError) {
      // handle the error
    } catch (e) {
      // handle the error
    }
 }

AppsFlyer

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€AppsFlyer インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。

 import 'package:appsflyer_sdk/appsflyer_sdk.dart';

 AppsflyerSdk appsflyerSdk = AppsflyerSdk(<YOUR_OPTIONS>);
 
 appsflyerSdk.onInstallConversionData((data) async {
     try {
         final appsFlyerUID = await appsFlyerSdk.getAppsFlyerUID();
-         await Adapty().updateAttribution(
-           data,
-           source: AdaptyAttributionSource.appsflyer,
-           networkUserId: appsFlyerUID,
-         );
+         await Adapty().setIntegrationIdentifier(
+           key: "appsflyer_id", 
+           value: appsFlyerUID,
+         );
+         
+         await Adapty().updateAttribution(data, source: "appsflyer");
     } on AdaptyError catch (adaptyError) {
         // handle the error

      } catch (e) {
          // handle the error
      }
 });

 appsflyerSdk.initSdk(
     registerConversionDataCallback: true,
     registerOnAppOpenAttributionCallback: true,
     registerOnDeepLinkingCallback: true,
 );

Branch

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Branch インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。


FlutterBranchSdk.initSession().listen((data) async {
  try {
+     await Adapty().setIntegrationIdentifier(
+         key: "branch_id", 
+         value: <BRANCH_IDENTITY_ID>,
+     );
-    await Adapty().updateAttribution(data, source: AdaptyAttributionSource.branch);
+    await Adapty().updateAttribution(data, source: "branch");
  } on AdaptyError catch (adaptyError) {
      // handle the error
  } catch (e) {
      // handle the error
  }
);

Firebase and Google Analytics

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Firebase and Google Analytics インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。


final appInstanceId = await FirebaseAnalytics.instance.appInstanceId;

try {
-  final builder = AdaptyProfileParametersBuilder()
-         ..setFirebaseAppInstanceId(appInstanceId);
-  await adapty.updateProfile(builder.build());

+  await Adapty().setIntegrationIdentifier(
+         key: "firebase_app_instance_id", 
+         value: appInstanceId,
+  );
} on AdaptyError catch (adaptyError) {
    // handle the error
} catch (e) {
    // handle the error
}

Mixpanel

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Mixpanel インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。


final mixpanel = await Mixpanel.init("Your Token", trackAutomaticEvents: true);
final distinctId = await mixpanel.getDistinctId();

try {
-   final builder = AdaptyProfileParametersBuilder()
-      ..setMixpanelUserId(distinctId);
-     await Adapty().updateProfile(builder.build());

+     await Adapty().setIntegrationIdentifier(
+         key: "mixpanel_user_id", 
+         value: distinctId,
+     );
} on AdaptyError catch (adaptyError) {
    // handle the error
} catch (e) {
    // handle the error
}

OneSignal

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€OneSignal インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。

 OneSignal.shared.setSubscriptionObserver((changes) {
     final playerId = changes.to.userId;
     if (playerId != null) {
-         final builder = 
-             AdaptyProfileParametersBuilder()
-                 ..setOneSignalPlayerId(playerId);
-                 // ..setOneSignalSubscriptionId(playerId);
          try {
-             Adapty().updateProfile(builder.build());

+             await Adapty().setIntegrationIdentifier(
+                 key: "one_signal_player_id", 
+                 value: playerId,
+             );
          } on AdaptyError catch (adaptyError) {
              // handle error
          } catch (e) {
              // handle error
          }
     }
 });

Pushwoosh

以下ã®ã‚ˆã†ã«ãƒ¢ãƒã‚¤ãƒ«ã‚¢ãƒ—リã®ã‚³ãƒ¼ãƒ‰ã‚’æ›´æ–°ã—ã¦ãã ã•ã„。完全ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Pushwoosh インテグレーション㮠SDK 設定をã”覧ãã ã•ã„。


final hwid = await Pushwoosh.getInstance.getHWID;

- final builder = AdaptyProfileParametersBuilder()
-         ..setPushwooshHWID(hwid);
  try {
-     await adapty.updateProfile(builder.build());

+     await Adapty().setIntegrationIdentifier(
+         key: "pushwoosh_hwid", 
+         value: hwid,
+     );
  } on AdaptyError catch (adaptyError) {
      // handle the error
  } catch (e) {
      // handle the error
  }

Observer モードã®å®Ÿè£…ã‚’æ›´æ–°ã™ã‚‹

ペイウォールã¨ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ã‚’ç´ä»˜ã‘る方法を更新ã—ã¦ãã ã•ã„。以å‰ã¯ setVariationId メソッドを使ã£ã¦ variationId を割り当ã¦ã¦ã„ã¾ã—ãŸãŒã€ç¾åœ¨ã¯æ–°ã—ã„ reportTransaction メソッドã§ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ã‚’記録ã™ã‚‹éš›ã« variationId を直接å«ã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚最終的ãªã‚³ãƒ¼ãƒ‰ä¾‹ã«ã¤ã„ã¦ã¯ã€Observer モードã§ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’購入トランザクションã«é–¢é€£ä»˜ã‘ã‚‹ã‚’ã”覧ãã ã•ã„。

reportTransaction メソッドを使ã£ã¦ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ã‚’å¿…ãšè¨˜éŒ²ã—ã¦ãã ã•ã„。ã“ã®æ‰‹é †ã‚’çœç•¥ã™ã‚‹ã¨ã€Adapty ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ã‚’èªè­˜ã§ããšã€ã‚¢ã‚¯ã‚»ã‚¹ãƒ¬ãƒ™ãƒ«ã®ä»˜ä¸Žã€ã‚¢ãƒŠãƒªãƒ†ã‚£ã‚¯ã‚¹ã¸ã®è¨˜éŒ²ã€ã‚¤ãƒ³ãƒ†ã‚°ãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ã¸ã®é€ä¿¡ãŒã„ãšã‚Œã‚‚行ã‚れã¾ã›ã‚“。ã“ã®æ‰‹é †ã¯å¿…é ˆã§ã™ï¼

 try {
-     await Adapty().setVariationId("YOUR_TRANSACTION_ID", "PAYWALL_VARIATION_ID");

+     // every time when calling transaction.finish()
+     await Adapty().reportTransaction(
+         "YOUR_TRANSACTION_ID", 
+         variationId: "PAYWALL_VARIATION_ID", // optional
+     );
  } on AdaptyError catch (adaptyError) {
      // handle the error
  } catch (e) {
      // handle the error
  }
ÿÿÿÿ