Démarrage
Copiez un prompt de configuration avec les étapes d'installation et le guide markdown complet pour ce plugin.
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.
Installer
Section intitulée « Installer »bun add @capgo/capacitor-rudderstackbunx cap syncImporter
Section intitulée « Importer »import { nativePlugin } from '@capgo/capacitor-rudderstack';API Vue d'ensemble
Section intitulée « API Vue d'ensemble »initialize
Section intitulée « Initialiser »Initialise le client RudderStack.
La méthode conserve la signature de Cordova, donc le deuxième argument peut être soit un objet de configuration ou un objet Rudder options.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('value');identify
Section intitulée « identifier »Envoie un appel d'identification pour l'ID d'utilisateur fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('value');Envoie un appel de groupe pour l'ID de groupe fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('value');Envoie un appel de suivi pour le nom d'événement fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('value');Envoie un appel d'écran pour le nom d'écran fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('value');Alias le compte actuel à un nouveau identifiant.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('value');Réinitialise l'état d'identité RudderStack actuel.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();Vide les événements en file d'attente immédiatement.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.flush();putDeviceToken
Section intitulée « mettre le jeton de l'appareil »Définit le jeton de mise à jour poussée que RudderStack envoie aux destinations prises en charge.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putDeviceToken('value');setAdvertisingId
Section intitulée « Définir l'ID publicitaire »Voir les définitions de source pour le contrat actuel.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('value');putAdvertisingId
Section intitulée « mettre l'ID publicitaire »Définit une valeur d'ID publicitaire personnalisée.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('value');setAnonymousId
Section intitulée « Définir l'ID anonyme »Voir les définitions de source pour le contrat actuel.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('value');putAnonymousId
Section intitulée « putAnonymousId »Définit une valeur d'ID anonyme personnalisée.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('value');Bascule la suppression de suivi de RudderStack.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);Référence de type
Section intitulée « Référence de type »RudderConfiguration
Section intitulée « Configuration de Rudder »Clés de configuration prises en charge pour les SDK natifs RudderStack sous-jacents.
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
Section intitulée « Options de Rudder »Options de RudderStack par appel.
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
Section intitulée “RudderTraits”Payload de traits accepté par identify et group.
export type RudderTraits = Record<string, any>;RudderProperties
Section intitulée “RudderProperties”Payload de propriétés accepté par track et screen.
export type RudderProperties = Record<string, any>;PluginVersionResult
Section intitulée “PluginVersionResult”Payload de version de plugin.
export interface PluginVersionResult { /** * Version identifier returned by the platform implementation. */ version: string;}RudderLogLevelValue
Section intitulée « RudderLogLevelValue »Niveaux de journalisation RudderStack exposés pour commodité de migration.
export type RudderLogLevelValue = 0 | 1 | 2 | 3 | 4 | 5;Source de Vérité
Section intitulée « Source de Vérité »Cette page est générée à partir du plugin. src/definitions.tsRe-run la synchronisation lorsque le public API change en amont.