はじめに
このプラグインのセットアップ用にインストール手順と全てのマークダウンガイドを含むコピー可能なコマンドをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-rudderstack`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/rudderstack/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAI-Assisted Setupを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のコマンドを使用してください:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-rudderstack` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してください。プラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-rudderstackbunx cap syncインポート
「インポート」のセクションimport { nativePlugin } from '@capgo/capacitor-rudderstack';APIの概要
APIの概要のセクションinitialize
initializeRudderStackクライアントを初期化します。
メソッドはCordovaの署名を保持しているため、2番目の引数はconfigオブジェクトかRudderオプションオブジェクトのいずれかになります。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('write-key-123');identify
identify指定されたユーザIDに対してidentifyコールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('user-id-123');group
group指定されたグループIDに対してgroupコールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('group-id-123');track
track指定されたイベント名に対してtrackコールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('event');screen
「画面」セクション指定された画面名の「画面」コールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('screen');alias
「エイリアス」セクション現在のユーザーを新しい識別子にエイリアスします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('new-id-123');reset
「リセット」セクション現在のRudderStack IDの状態をリセットします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();flush
「フラッシュ」セクション即時でキュー内のイベントをフラッシュします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.flush();putDeviceToken
「デバイストークンを設定」セクションRudderStackがサポートするすべての宛先に送信するデバイストークンを設定します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putDeviceToken('device-token-123');setAdvertisingId
「広告IDを設定」セクション現在の契約のソース定義を参照してください。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('advertising-id-123');putAdvertisingId
「広告IDを設定」セクションカスタム広告IDの値を設定します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('advertising-id-123');setAnonymousId
「匿名IDを設定」セクション現在の契約のソース定義を参照してください。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('anonymous-id-123');putAnonymousId
「putAnonymousId」のセクションカスタムの匿名ID値を設定します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('anonymous-id-123');optOut
「optOut」のセクションルダースタックのトラッキングをオフにします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);型の参照
「型の参照」のセクションRudderConfiguration
「RudderConfiguration」のセクションルダースタックのネイティブSDKのサポートされる構成キー
export interface RudderConfiguration { /** * RudderStack data plane URL. */ dataPlaneUrl?: string;
/** * Number of events to batch before a flush. */ flushQueueSize?: number;
/** * Database row threshold that triggers pruning on Android and iOS. */ dbCountThreshold?: number;
/** * Server config refresh interval in hours. */ configRefreshInterval?: number;
/** * RudderStack log verbosity. */ logLevel?: RudderLogLevelValue;
/** * Sleep timeout / sleep count used by the native SDK. */ sleepTimeOut?: number;
/** * Android only. Lets the native SDK collect the advertising identifier automatically. */ autoCollectAdvertId?: boolean;
/** * Tracks `Application Installed`, `Application Updated`, and `Application Opened` automatically. */ trackLifecycleEvents?: boolean;
/** * RudderStack control plane URL. */ controlPlaneUrl?: string;
/** * Enables automatic screen tracking where supported by the native SDK. */ recordScreenViews?: boolean;
/** * Ignored in this Capacitor port. * * The Cordova SDK uses this field to bootstrap native destination factories from companion plugins. * Those extension packages are not implemented in this first Capacitor release. */ factories?: any[];}RudderOptions
「RudderOptions」セクションRudderStackご利用ごとにオプション
export interface RudderOptions { /** * External identifiers forwarded with the event. */ externalIds?: Record<string, string>;
/** * Destination enablement flags keyed by integration name. */ integrations?: Record<string, boolean>;}RudderTraits
「RudderTraits」セクションTraitsを受け入れる identify そして group.
export type RudderTraits = Record<string, any>;RudderProperties
「RudderProperties」セクションPropertiesを受け入れる track そして screen.
export type RudderProperties = Record<string, any>;PluginVersionResult
プラグインバージョン結果プラグインバージョンペイロード。
export interface PluginVersionResult { /** * Version identifier returned by the platform implementation. */ version: string;}RudderLogLevelValue
「RudderLogLevelValue」のセクションRudderStackログレベル値を提供します。
export type RudderLogLevelValue = 0 | 1 | 2 | 3 | 4 | 5;真実の源
「真実の源」のセクションこのページはプラグインの src/definitions.tsパブリックAPIがアップストリームで変更された場合に再度Syncを実行してください。
Getting Startedから続けてください
「Getting Startedから続けてください」のセクションあなたが スタートガイド 計画ダッシュボードとAPIの運用を計画し、接続する @capgo/capacitor-ルッダースタック Capgoのnative機能の使用に@capgo/capacitor-rudderstackを使用します。 API APIの実装詳細についての概要です。 導入 ルーダースタックのキー API キー for API Keys の実装詳細に ルーダースタックの実装詳細 デバイス