본문으로 건너뛰기

SDK 설치하기

런타임에 맞는 SDK를 고르세요. 모두 같은 인제스트 엔드포인트로 이벤트를 보내고 동일한 규칙으로 기능 플래그를 로컬에서 평가하므로, 무엇을 고르든 사용자는 같은 롤아웃에 속합니다.

이 코드 조각들의 키는 콘솔에서 받습니다: API 키 받기

At a glance

Packages
@prodantix/sdk (web), prodantix_sdk (Dart), prodantix_sdk_flutter (Flutter), prodantix-sdk (Python)
Ingest host
https://eu.api.prodantix.com
Flags host
https://api.prodantix.com
Credentials
Public project key in the client, access token for GraphQL
Verify
Read the event back from the events query

브라우저와 Node

Bash
bun add @prodantix/sdk

# React 앱은 어댑터도 함께 씁니다:
bun add @prodantix/react
JavaScript
import { createWebClient } from '@prodantix/sdk/web';

const prodantix = createWebClient({
  apiKey: PRODANTIX_PUBLIC_KEY,
  host: 'https://eu.api.prodantix.com',
  flagsHost: 'https://api.prodantix.com',
});

prodantix.capture('order.completed', { properties: { amount: 4200 } });
JavaScript
import { ProdantixProvider, useProdantix } from '@prodantix/react';

<ProdantixProvider options={{ apiKey: PRODANTIX_PUBLIC_KEY, host: 'https://eu.api.prodantix.com' }}>
  <App />
</ProdantixProvider>

const prodantix = useProdantix();
prodantix?.capture('order.completed');

Flutter와 Dart

Bash
flutter pub add prodantix_sdk_flutter

# Flutter 계층 없는 Dart 서버 또는 CLI:
dart pub add prodantix_sdk

Python 서버

Bash
pip install prodantix-sdk

프로젝트 키는 공개 값입니다. 프로젝트를 가리킬 뿐 데이터 접근 권한을 주지 않으므로 클라이언트 코드에 넣어도 됩니다. 쓰기가 가능한 서버 키는 절대 넣지 마세요.

도착 확인

Ingestion answers 202 as soon as the batch is accepted. To see the event itself, read it back from the events query, or watch it arrive on the realtime project room.

Bash
curl "https://api.prodantix.com/graphql" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ events(projectId: \"p_1\", limit: 5) { name receivedAt } }"}'