メインコンテンツへスキップ

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 } }"}'