Inizia
Copia un prompt di configurazione con i passaggi di installazione e la guida markdown completa per questo 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.
Installa
Sezione intitolata “Installa”bun add @capgo/capacitor-rudderstackbunx cap syncImporta
Sezione intitolata “Importa”import { nativePlugin } from '@capgo/capacitor-rudderstack';API Panoramica
Sezione intitolata “API Panoramica”initialize
Sezione intitolata “inizializza”Inizializza il client RudderStack.
Il metodo mantiene la firma Cordova, quindi l'argomento secondario può essere sia un oggetto di configurazione che un oggetto Rudder.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('value');identify
Sezione intitolata “identifica”Invia un chiamata di identificazione per l'ID utente fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('value');Invia una chiamata di gruppo per l'ID del gruppo fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('value');Invia una chiamata di tracciamento per il nome dell'evento fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('value');Invia una chiamata di schermo per il nome dello schermo fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('value');Alias il corrente utente a un nuovo identificatore.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('value');Rimette allo stato di base l'identità corrente di RudderStack.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();Pulisce gli eventi in coda immediatamente.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.flush();putDeviceToken
Sezione intitolata “putDeviceToken”Imposta il token di push che RudderStack invia ai destinatari supportati.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putDeviceToken('value');setAdvertisingId
Sezione intitolata “setAdvertisingId”Vedi le definizioni di riferimento per il contratto corrente.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('value');putAdvertisingId
Sezione intitolata “impostaIdDellAnnuncio”Imposta un valore personalizzato per l'ID dell'annuncio.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('value');setAnonymousId
Sezione intitolata “impostaIdAnonimo”Vedi le definizioni di riferimento per il contratto corrente.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('value');putAnonymousId
Sezione intitolata “impostaIdAnonimo”Imposta un valore personalizzato per l'ID anonimo.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('value');Abilita o disabilita l'invio di tracce di RudderStack.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);Riferimento al tipo
Sezione intitolata “Riferimento al tipo”RudderConfiguration
Sezione intitolata “RudderConfiguration”Chiavi di configurazione supportate per gli SDK nativi di 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
Sezione intitolata “RudderOptions”Opzioni di RudderStack per chiamata.
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
Sezione intitolata “RudderTraits”Payload accettati da identify e group.
export type RudderTraits = Record<string, any>;RudderProperties
Sezione intitolata “RudderProperties”Payload di proprietà accettate da track e screen.
export type RudderProperties = Record<string, any>;PluginVersionResult
Sezione intitolata “PluginVersionResult”Payload di versione del plugin.
export interface PluginVersionResult { /** * Version identifier returned by the platform implementation. */ version: string;}RudderLogLevelValue
Sezione intitolata “RudderLogLevelValue”Valori di livello di registro RudderStack esposti per comodità di migrazione.
export type RudderLogLevelValue = 0 | 1 | 2 | 3 | 4 | 5;Copia negli appunti
Sezione intitolata “Fonte di Verità”Questa pagina è generata dal plugin src/definitions.tsRiepiloga quando le modifiche pubbliche API sono state apportate in fase di sincronizzazione.