はじめに
このプラグインのインストールステップとフルマークダウンガイドのセットアップ用の質問をコピーする。
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.
インストール
「インストール」のセクションbun add @capgo/capacitor-rudderstackbunx cap syncインポート
「インポート」のセクションimport { nativePlugin } from '@capgo/capacitor-rudderstack';API オーバービュー
「API オーバービュー」のセクションinitialize
「初期化」のセクションRudderStackクライアントを初期化します。
メソッドはCordovaの署名を保持しているので、2番目の引数はconfigオブジェクトかRudderオプションオブジェクトのいずれかになります。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('value');identify
「identify」セクション指定されたユーザIDのためにidentifyコールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('value');group
「group」セクション指定されたグループIDのためにgroupコールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('value');track
「track」セクション指定されたイベント名のためにtrackコールを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('value');screen
「画面」セクション__CAPGO_KEEP_0__の画面名を指定して画面呼び出しを送信します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('value');alias
「エイリアス」セクション__CAPGO_KEEP_0__の新しい識別子に現在のユーザーをエイリアスします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('value');reset
「リセット」セクション__CAPGO_KEEP_0__の現在のルーダースタックIDをリセットします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();flush
「フラッシュ」セクション__CAPGO_KEEP_0__のキューされたイベントを即座にフラッシュします。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.flush();putDeviceToken
Section titled “デバイストークンを設定”RudderStackがサポートする目的地に送信するデバイストークンを設定します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putDeviceToken('value');setAdvertisingId
Section titled “広告IDを設定”現在の契約のソース定義を参照してください。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('value');putAdvertisingId
Section titled “広告IDを設定”カスタム広告ID値を設定します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('value');setAnonymousId
Section titled “匿名IDを設定”現在の契約のソース定義を参照してください。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('value');putAnonymousId
「匿名IDを設定する」セクションカスタムの匿名ID値を設定します。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('value');optOut
「オプトアウト」セクションRudderStackのトラッキングオプトアウトを切り替えます。
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);タイプ リファレンス
「タイプ リファレンス」セクションRudderConfiguration
「ルーダー設定」セクションサポートされているルーダー設定のキーのリストです。
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
「ルーダー設定」オプションRudderStack 1回あたりのオプション。
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」セクション受け入れる RudderTraits のペイロード identify 、 group.
export type RudderTraits = Record<string, any>;RudderProperties
「RudderProperties」セクション受け入れる RudderProperties のペイロード track 、 screen.
export type RudderProperties = Record<string, any>;PluginVersionResult
「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 がアップストリームで変更された場合に再度同期を実行してください。