Getting Started
Copia un prompt di installazione 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”Puoi utilizzare la nostra configurazione assistita da AI per installare il plugin. Aggiungi le Capgo competenze al tuo strumento AI utilizzando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsPoi utilizza la seguente richiesta:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-rudderstack` plugin in my project.Se preferisci la configurazione manuale, installa il plugin eseguendo i seguenti comandi e segui le istruzioni specifiche del tuo platform sotto:
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 il secondo argomento può essere sia un oggetto di configurazione che un oggetto di opzioni Rudder.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('write-key-123');identify
Sezione intitolata “identifica”Invia un chiamata di identificazione per l'ID utente fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('user-id-123');Invia una chiamata di gruppo per l'ID gruppo fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('group-id-123');Invia una chiamata di track per il nome dell'evento fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('event');Invia una chiamata di schermo per il nome dello schermo fornito.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('screen');Alias il corrente utente a un nuovo identificatore.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('new-id-123');Ripristina lo stato di identità RudderStack corrente.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();Flusha 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('device-token-123');setAdvertisingId
Sezione intitolata “setAdvertisingId”Vedi le definizioni di riferimento per il contratto corrente.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('advertising-id-123');putAdvertisingId
Sezione intitolata “putAdvertisingId”Sets a custom advertising id value.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('advertising-id-123');setAnonymousId
Sottosezione intitolata “setAnonymousId”Vedi le definizioni di origine per il contratto corrente.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('anonymous-id-123');putAnonymousId
Sottosezione intitolata “putAnonymousId”Imposta un valore di ID anonimo personalizzato.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('anonymous-id-123');Abilita o disabilita la tracciatura RudderStack.
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);Riferimento al tipo
Sottosezione intitolata “Riferimento al tipo”RudderConfiguration
Sezione intitolata “Configurazione Rudder”Sono supportate le chiavi di configurazione per i relativi SDK nativi 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 “Opzioni Rudder”Opzioni per chiamata di 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
Sezione intitolata “Caratteristiche Rudder”Caratteristiche accettate dal payload di identify e group.
export type RudderTraits = Record<string, any>;RudderProperties
Sezione intitolata “Proprietà Rudder”Proprietà accettate dal payload di track E e screen.
export type RudderProperties = Record<string, any>;PluginVersionResult
Sottosezione intitolata “PluginVersionResult”Payload della versione del plugin.
export interface PluginVersionResult { /** * Version identifier returned by the platform implementation. */ version: string;}RudderLogLevelValue
Sottosezione intitolata “RudderLogLevelValue”Livelli di registrazione RudderStack esposti per comodità di migrazione.
export type RudderLogLevelValue = 0 | 1 | 2 | 3 | 4 | 5;Sottosezione intitolata “Fonte di verità”
Questa pagina è generata dal plugin’sQuesta pagina è generata dal plugin. src/definitions.ts. Re-run the sync when the public API changes upstream.
Keep going from Getting Started
Sezione intitolata “Continua da Inizia”Se stai utilizzando Getting Started per pianificare il dashboard e le operazioni di API, connettilo con Utilizza @capgo/capacitor-rudderstack per la capacità nativa in Utilizza @capgo/capacitor-rudderstack, API Overview per i dettagli di implementazione in API Overview, Introduzione per i dettagli di implementazione in Introduzione, API Keys per i dettagli di implementazione in API Chiavi, e Dispositivi per i dettagli di implementazione nei dispositivi.