ÿÿ オンボーディング | React Native SDK | Adapty ドキュメント

React Native SDKã§ã‚ªãƒ³ãƒœãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã®ãƒ‡ãƒ¼ã‚¿ã‚’処ç†ã™ã‚‹

オンボーディングã¯SDK v4ã§éžæŽ¨å¥¨ã¨ãªã‚Šã€å°†æ¥ã®ãƒªãƒªãƒ¼ã‚¹ã§å‰Šé™¤ã•れる予定ã§ã™ã€‚ ãƒã‚°ä¿®æ­£ã‚„機能改善ã¯è¡Œã‚れã¾ã›ã‚“。代ã‚りã«ãƒ•ローをã”利用ãã ã•ã„。オンボーディングã¯WebView内ã§å‹•作ã—ã¾ã™ãŒã€ãƒ•ローã¯ãƒ‡ãƒã‚¤ã‚¹ä¸Šã§ãƒã‚¤ãƒ†ã‚£ãƒ–ã«ãƒ¬ãƒ³ãƒ€ãƒªãƒ³ã‚°ã•れるãŸã‚ã€ã‚ˆã‚Šã‚¹ãƒ ãƒ¼ã‚ºãªã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ã€ä¸€è²«ã—ãŸãƒã‚¤ãƒ†ã‚£ãƒ–ã®å¤–観ã€é«˜é€Ÿãªèª­ã¿è¾¼ã¿ã€WebViewランタイムã¸ã®ä¾å­˜ãªã—ã§åˆ©ç”¨ã§ãã¾ã™ã€‚詳細ã¯ãƒ•ローã¨ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã®å–å¾—ãŠã‚ˆã³ãƒ•ローã¨ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã®è¡¨ç¤ºã‚’ã”覧ãã ã•ã„。

ユーザーãŒã‚¯ã‚¤ã‚ºã®è³ªå•ã«å›žç­”ã—ãŸã‚Šã€å…¥åŠ›ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã«ãƒ‡ãƒ¼ã‚¿ã‚’入力ã—ãŸã‚Šã™ã‚‹ã¨ã€onStateUpdatedAction メソッドãŒå‘¼ã³å‡ºã•れã¾ã™ã€‚フィールドタイプをコード内ã§ä¿å­˜ã¾ãŸã¯å‡¦ç†ã§ãã¾ã™ã€‚

例:

// Full-screen presentation
const unsubscribe = view.setEventHandlers({
  onStateUpdated(action, meta) {
    // Process data 
  },
});

// Embedded widget
<AdaptyOnboardingView
  onboarding={onboarding}
  eventHandlers={{
    onStateUpdated(action, meta) {
      // Process data 
    },
  }}
/>

アクションã®å½¢å¼ã¯ã“ã¡ã‚‰ã‚’ã”覧ãã ã•ã„。

ä¿å­˜ã•れãŸãƒ‡ãƒ¼ã‚¿ã®ä¾‹ï¼ˆå®Ÿè£…ã«ã‚ˆã£ã¦å½¢å¼ãŒç•°ãªã‚‹å ´åˆãŒã‚りã¾ã™ï¼‰
// Example of a saved select action
{
    "elementId": "preference_selector",
    "elementType": "select",
    "value": {
        "id": "option_1",
        "value": "premium",
        "label": "Premium Plan"
    },
    "meta": {
        "onboardingId": "onboarding_123",
        "screenClientId": "preferences_screen",
        "screenIndex": 1,
        "totalScreens": 3
    }
}

// Example of a saved multi-select action
{
    "elementId": "interests_selector",
    "elementType": "multi_select",
    "value": [
        {
            "id": "interest_1",
            "value": "sports",
            "label": "Sports"
        },
        {
            "id": "interest_2",
            "value": "music",
            "label": "Music"
        }
    ],
    "meta": {
        "onboardingId": "onboarding_123",
        "screenClientId": "interests_screen",
        "screenIndex": 2,
        "totalScreens": 3
    }
}

// Example of a saved input action
{
    "elementId": "name_input",
    "elementType": "input",
    "value": {
        "type": "text",
        "value": "John Doe"
    },
    "meta": {
        "onboardingId": "onboarding_123",
        "screenClientId": "profile_screen",
        "screenIndex": 0,
        "totalScreens": 3
    }
}

// Example of a saved date picker action
{
    "elementId": "birthday_picker",
    "elementType": "date_picker",
    "value": {
        "day": 15,
        "month": 6,
        "year": 1990
    },
    "meta": {
        "onboardingId": "onboarding_123",
        "screenClientId": "profile_screen",
        "screenIndex": 0,
        "totalScreens": 3
    }
}

ユースケース

ユーザープロファイルã«ãƒ‡ãƒ¼ã‚¿ã‚’付加ã™ã‚‹

入力データをユーザープロファイルã¨ã™ãã«ç´ä»˜ã‘ã¦ã€åŒã˜æƒ…報を二度尋ã­ãªã„よã†ã«ã™ã‚‹ã«ã¯ã€ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã‚’処ç†ã™ã‚‹éš›ã«å…¥åŠ›ãƒ‡ãƒ¼ã‚¿ã§ãƒ¦ãƒ¼ã‚¶ãƒ¼ãƒ—ロファイルを更新ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚

ãŸã¨ãˆã°ã€name ã¨ã„ã†IDã®ãƒ†ã‚­ã‚¹ãƒˆãƒ•ィールドã§ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«åå‰ã‚’入力ã—ã¦ã‚‚らã„ã€ãã®å€¤ã‚’ユーザーã®ãƒ•ァーストãƒãƒ¼ãƒ ã¨ã—ã¦è¨­å®šã—ãŸã„ã¨ã—ã¾ã™ã€‚ã¾ãŸã€email フィールドã§ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚‚入力ã—ã¦ã‚‚らã†ã¨ã—ã¾ã™ã€‚アプリã®ã‚³ãƒ¼ãƒ‰ã§ã¯ã€æ¬¡ã®ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚

// Full-screen presentation
const unsubscribe = view.setEventHandlers({
  onStateUpdated(action, meta) {
    // Store user preferences or responses
    if (action.elementType === 'input') {
      const profileParams = {};
      
      // Map elementId to appropriate profile field
      switch (action.elementId) {
        case 'name':
          if (action.value.type === 'text') {
            profileParams.firstName = action.value.value;
          }
          break;
        case 'email':
          if (action.value.type === 'email') {
            profileParams.email = action.value.value;
          }
          break;
      }
      
      // Update profile if we have data to update
      if (Object.keys(profileParams).length > 0) {
        adapty.updateProfile(profileParams).catch(error => {
          // handle the error
        });
      }
    }
  },
});

// Embedded widget
<AdaptyOnboardingView
  onboarding={onboarding}
  eventHandlers={{
    onStateUpdated(action, meta) {
      // Store user preferences or responses
      if (action.elementType === 'input') {
        const profileParams = {};
        
        // Map elementId to appropriate profile field
        switch (action.elementId) {
          case 'name':
            if (action.value.type === 'text') {
              profileParams.firstName = action.value.value;
            }
            break;
          case 'email':
            if (action.value.type === 'email') {
              profileParams.email = action.value.value;
            }
            break;
        }
        
        // Update profile if we have data to update
        if (Object.keys(profileParams).length > 0) {
          adapty.updateProfile(profileParams).catch(error => {
            // handle the error
          });
        }
      }
    },
  }}
/>

アンケートã®å›žç­”ã«åŸºã¥ã„ã¦ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’カスタマイズã™ã‚‹

オンボーディングã§ã‚¯ã‚¤ã‚ºã‚’使用ã™ã‚‹ã“ã¨ã§ã€ã‚ªãƒ³ãƒœãƒ¼ãƒ‡ã‚£ãƒ³ã‚°å®Œäº†å¾Œã«ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«è¡¨ç¤ºã™ã‚‹ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’カスタマイズã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ã€‚

ãŸã¨ãˆã°ã€ã‚¹ãƒãƒ¼ãƒ„ã®çµŒé¨“ã«ã¤ã„ã¦ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«è³ªå•ã—ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚°ãƒ«ãƒ¼ãƒ—ã”ã¨ã«ç•°ãªã‚‹CTAやプロダクトを表示ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚

  1. オンボーディングビルダーã§ã‚¯ã‚¤ã‚ºã‚’追加ã—ã€å„é¸æŠžè‚¢ã«æ„味ã®ã‚ã‚‹IDを割り当ã¦ã¾ã™ã€‚
experience.webp
  1. IDã«åŸºã¥ã„ã¦ã‚¯ã‚¤ã‚ºã®å›žç­”を処ç†ã—ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«ã‚«ã‚¹ã‚¿ãƒ å±žæ€§ã‚’設定ã—ã¾ã™ã€‚
// Full-screen presentation
const unsubscribe = view.setEventHandlers({
  onStateUpdated(action, meta) {
    // Handle quiz responses and set custom attributes
    if (action.elementType === 'select') {
      const profileParams = {};
      
      // Map quiz responses to custom attributes
      switch (action.elementId) {
        case 'experience':
          // Set custom attribute 'experience' with the selected value (beginner, amateur, pro)
          profileParams.codableCustomAttributes = {
            experience: action.value.value
          };
          break;
      }
      
      // Update profile if we have data to update
      if (Object.keys(profileParams).length > 0) {
        adapty.updateProfile(profileParams).catch(error => {
          // handle the error
        });
      }
    }
  },
});

// Embedded widget
<AdaptyOnboardingView
  onboarding={onboarding}
  eventHandlers={{
    onStateUpdated(action, meta) {
      // Handle quiz responses and set custom attributes
      if (action.elementType === 'select') {
        const profileParams = {};
        
        // Map quiz responses to custom attributes
        switch (action.elementId) {
          case 'experience':
            // Set custom attribute 'experience' with the selected value (beginner, amateur, pro)
            profileParams.codableCustomAttributes = {
              experience: action.value.value
            };
            break;
        }
        
        // Update profile if we have data to update
        if (Object.keys(profileParams).length > 0) {
          adapty.updateProfile(profileParams).catch(error => {
            // handle the error
          });
        }
      }
    },
  }}
/>
  1. カスタム属性ã®å€¤ã”ã¨ã«ã‚»ã‚°ãƒ¡ãƒ³ãƒˆã‚’作æˆã—ã¾ã™ã€‚
  2. プレースメントを作æˆã—ã€ä½œæˆã—ãŸå„セグメントã«å¯¾ã—ã¦ã‚ªãƒ¼ãƒ‡ã‚£ã‚¨ãƒ³ã‚¹ã‚’追加ã—ã¾ã™ã€‚
  3. アプリã®ã‚³ãƒ¼ãƒ‰ã§ã€ãã®ãƒ—レースメントã«å¯¾ã™ã‚‹ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’表示ã—ã¾ã™ã€‚オンボーディングã«ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã‚’é–‹ãボタンãŒã‚ã‚‹å ´åˆã¯ã€ã“ã®ãƒœã‚¿ãƒ³ã®ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¸ã®å¿œç­”ã¨ã—ã¦ãƒšã‚¤ã‚¦ã‚©ãƒ¼ãƒ«ã®ã‚³ãƒ¼ãƒ‰ã‚’実装ã—ã¦ãã ã•ã„。
ÿÿÿÿ