__CAPGO_KEEP_0__의 채널을 사용하여 기능 플래그 및 A/B 테스트를 학습하세요. 사용자 자체 할당 또는 백엔드 사용 - 실시간으로 업데이트를 관리하세요.
강의

기능 플래그 및 A/B 테스트를 위한 채널 사용 방법

기능 플래그 및 A/B 테스트를 위한 Capgo의 채널을 사용하는 방법을 알아보세요. 사용자를 자체 할당하거나 백엔드 사용

기사 기여자

마틴 도나디우

페이지/영역: Enterprise 제품/가격 페이지. 역할: UI 레이블. 표시되는 곳: 페이지 enterprise.astro. 메시지 키 `enterprise_partnership_capgo_martin_name` (Enterprise Partnership Capgo Martin Name).

작가

발레리아

페이지/영역: Enterprise 제품/가격 페이지. 역할: UI 레이블. 표시되는 곳: 페이지 enterprise.astro. 메시지 키 `enterprise_partnership_capgo_valeria_name` (Enterprise Partnership Capgo Valeria Name).

리뷰어

조던

How to Use Channels for Feature Flags and A/B Testing

Capgo의 채널 시스템은 사용자들을 구분하고 기능 접근을 제어하는 유연한 방법을 제공합니다. Capgo에는 기본적으로 계획 관리나 A/B 테스트 기능이 없지만, 채널 assignments를 관리하여 이러한 기능을 구현할 수 있습니다.

채널 이해

Capgo의 채널은 다음과 같은 기능을 제공합니다:

  • 특정 사용자 그룹에 다른 기능을 제공
  • A/B 테스트를 위해 사용자를 다른 채널에 할당
  • 새로운 기능을 점진적으로 출시
  • 베타 테스트 프로그램을 생성

채널 assignments 방법

이것은 더 안전한 방법입니다. updater에서 device ID를 가져오는 것을 포함합니다.

  1. __CAPGO_KEEP_0__
  2. 백엔드에 전송
  3. 백엔드가 Capgo API을 호출하여 장치를 할당

구현 방법은 다음과 같습니다:

import { CapacitorUpdater } from '@capgo/capacitor-updater'

// Get device ID
const getDeviceId = async () => {
  const { deviceId } = await CapacitorUpdater.getDeviceId()
  return deviceId
}

// Send device ID to your backend
const assignToChannel = async (channel: string) => {
  const deviceId = await getDeviceId()
  // Your backend will call Capgo API to assign the device
  await yourBackend.assignDeviceToChannel(deviceId, channel)
}

백엔드 구현

백엔드가 다음을 수행해야 합니다:

  1. API 키를 Capgo 대시보드에서 가져와야 합니다.
  2. Capgo API을 호출하여 장치를 채널에 할당해야 합니다.

API 키를 얻으려면:

  1. Capgo 대시보드에 로그인해야 합니다.
  2. 설정 > API 키로 이동합니다.
  3. 새 키를 생성하기 위해 '생성' 버튼을 클릭합니다.
  4. 선택 all 장치 및 채널 관리를 위한 모드
  5. 생성된 키를 안전하게 백엔드 환경 변수에 저장하세요
    • 키는 32 자리 16진수 문자열입니다
    • It’s a secret key that should never be exposed in client-side code

Node.js 예제입니다:

import axios from 'axios'

const CAPGO_API_KEY = 'your_api_key'
const CAPGO_API_URL = 'https://api.capgo.app'

async function assignDeviceToChannel(deviceId: string, channel: string) {
  try {
    const response = await axios.post(
      `${CAPGO_API_URL}/device`,
      {
        app_id: 'YOUR_APP_ID',
        device_id: deviceId,
        channel: channel
      },
      {
        headers: {
          'authorization': CAPGO_API_KEY,
          'Content-Type': 'application/json'
        }
      }
    )
    return response.data
  } catch (error) {
    console.error('Failed to assign device to channel:', error)
    throw error
  }
}

백엔드도:

  • 사용자의 권한을 검증하세요
  • 채널 할당을 모두 로그하세요
  • 할당 속도 제한을 처리하세요
  • 실패한 할당에 대한 재시도 로직을 구현하세요

2. 자체 할당(보안이 낮음)

이 방법은 장치가 직접 채널에 할당할 수 있습니다. 테스트에 유용하지만 프로덕션에 사용하는 것은 보안이 낮습니다:

import { CapacitorUpdater } from '@capgo/capacitor-updater'

// Assign device to channel
const assignToChannel = async (channel: string) => {
  await CapacitorUpdater.setChannel(channel)
}

// Get current channel
const getCurrentChannel = async () => {
  const { channel } = await CapacitorUpdater.getChannel()
  return channel
}

사용자가 채널에 자체 할당하기 전에, Capgo 대시보드에서 이 기능을 활성화해야 합니다:

  1. Capgo 대시보드의 채널 섹션으로 이동하세요
  2. 관리하고 싶은 채널 이름을 클릭하세요
  3. 채널 설정에서 '기기 자체 연관 설정 허용'을 활성화하세요
  4. 변경 사항을 저장하세요

이 설정이 false라면, 이 채널을 호출하는 시도는 실패합니다. setChannel 기능 플래그 구현

채널을 사용하여 기능 접근을 제어하세요:

A/B 테스트 구현

const isFeatureEnabled = async (feature: string) => {
  // Example: Check if user is in beta channel
  const channel = await getCurrentChannel()
  return channel === 'beta'
}

사용자를 다른 채널에 할당하여 A/B 테스트를 실행하세요:

최선의 방법

const assignToABTest = async (userId: string) => {
  // Use consistent hashing to assign users
  const hash = await hashUserId(userId)
  const variant = hash % 2 === 0 ? 'variant-a' : 'variant-b'
  
  await assignToChannel(variant)
  return variant
}

Best Practices

  1. 백엔드 할당 사용: 프로덕션에서 항상 백엔드 할당 방법을 사용하세요
  2. 일관된 할당: 사용자 ID 또는 다른 안정적인 식별자로 일관된 채널 할당을 사용하세요
  3. 모니터링: 각 채널의 기능 사용량과 성능 지표를 추적하세요
  4. 격차 롤아웃: 작은 사용자 세그먼트부터 시작하여 점진적으로 확장하세요
  5. 명확한 문서화: 채널 전략과 목적을 문서화하세요

결론

: Capgo의 채널 시스템을 활용하여 더 개인화된 앱 경험을 만들고 A/B 테스트를 수행할 수 있습니다. 프로덕션에서 항상 백엔드 할당 방법을 사용하여 보다 안전하고 제어할 수 있습니다.

For more details on channel management, check out our channels documentation.

Keep going from How to Use Channels for Feature Flags and A/B Testing

If you are using How to Use Channels for Feature Flags and A/B Testing to plan channel routing and staged rollout, connect it with Channels for the implementation detail in Channels Channels for the implementation detail in Channels Channels for the implementation detail in Channels Beta Testing Solution Beta Testing Solution을 위한 제품 워크플로우 및 Beta Testing Solution Version Targeting Solution Version Targeting Solution을 위한 제품 워크플로우

Capacitor 앱에 대한 실시간 업데이트

웹-layer 버그가 활성화된 경우 Capgo을 통해 수정을 배포하고 앱 스토어 승인 대기 없이 사용자가 배경에서 업데이트를 받도록 하세요. 네이티브 변경 사항은 일반적인 검토 경로를 유지합니다.

마틴의 인간 지원

시작하기

최신 블로그

Capgo은 전문적인 모바일 앱을 만들기 위해 필요한 최고의 통찰력을 제공합니다.