Prise en main
Copiez un prompt de configuration avec les étapes d'installation et la guide markdown complète 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.
Installation
Sous-titre « Installation »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA en utilisant la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la commande suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-rudderstack` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous.
bun add @capgo/capacitor-rudderstackbunx cap syncimport { nativePlugin } from '@capgo/capacitor-rudderstack';API Vue d'ensemble
Section titled “API Overview”initialize
Section intitulée « initialize »Initialise le client RudderStack.
La méthode conserve la signature Cordova, donc la deuxième argument peut être soit un objet de configuration, soit un objet d'options Rudder.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('write-key-123');identify
Section intitulée « identify »Envoie un appel d'identification pour l'ID utilisateur fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('user-id-123');Envoie un appel de groupe pour l'identifiant de groupe fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('group-id-123');Envoie un appel de suivi pour le nom de l'événement fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('event');Envoie un appel d'écran pour le nom de l'écran fourni.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('screen');Alias l'utilisateur actuel à un nouveau identifiant.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('new-id-123');Réinitialise l'état d'identité RudderStack actuel.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();Flushes queued events immediately.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.flush();putDeviceToken
Section intitulée « putDeviceToken »Définit le jeton de push que RudderStack transmet aux destinations prises en charge.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putDeviceToken('device-token-123');setAdvertisingId
Section intitulée « setAdvertisingId »Consultez les définitions de source pour le contrat actuel.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('advertising-id-123');putAdvertisingId
Section intitulée « putAdvertisingId »Définit une valeur personnalisée d'ID publicitaire.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('advertising-id-123');setAnonymousId
Section intitulée « setAnonymousId »Consultez les définitions sources pour le contrat actuel.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('anonymous-id-123');putAnonymousId
Section intitulée « putAnonymousId »Définit une valeur personnalisée d'ID anonyme.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('anonymous-id-123');Activer/désactiver l'opt-out de suivi de RudderStack.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);Référence de type
Section titled “Type Reference”RudderConfiguration
Section titled “RudderConfiguration”Clés de configuration prises en charge pour les SDK natifs RudderStack.
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 titled “RudderOptions”Options 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 titled “RudderTraits”Traits de payload acceptés par identify and group.
export type RudderTraits = Record<string, any>;RudderProperties
Section intitulée « RudderProperties »Propriétés du payload acceptées par track et screen.
export type RudderProperties = Record<string, any>;PluginVersionResult
Section intitulée « Version du plugin »Payload de version du plugin.
export interface PluginVersionResult { /** * Version identifier returned by the platform implementation. */ version: string;}RudderLogLevelValue
Valeur de niveau de log RudderNiveaux 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 des propriétés du plugin. src/definitions.tsRexécutez la synchronisation lorsque les données publiques API changent en amont.
Continuez de l'interface d'accueil.
Section intitulée « Continuez de l'interface d'accueil »Si vous utilisez L'interface d'accueil pour planifier votre tableau de bord et les opérations API, connectez-l’à Utilisez @capgo/capacitor-rudderstack pour la capacité native dans Utilisez @capgo/capacitor-rudderstack API Overview pour le détail d'implémentation dans API Overview Introduction pour le détail d'implémentation dans Introduction API Clés pour les détails d'implémentation dans API Clés, et Appareils pour les détails d'implémentation sur les appareils.