Saltarse al contenido

Iniciación

Sección titulada “Instalar”

Ventana de terminal
Preparado para copiar
bun add @capgo/capacitor-rudderstack
bunx cap sync
import { nativePlugin } from '@capgo/capacitor-rudderstack';

Inicia el cliente RudderStack.

El método conserva la firma de Cordova, por lo que el segundo argumento puede ser una configuración de objeto o un objeto de opciones de Rudder.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize('value');

Envía una llamada de identificación para el ID de usuario proporcionado.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.identify('value');

Envía una llamada de grupo para el identificador de grupo proporcionado.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.group('value');

Envía una llamada de pista para el nombre de evento proporcionado.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.track('value');

Envía una llamada de pantalla para el nombre de pantalla proporcionado.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.screen('value');

Asigna un alias al usuario actual a un nuevo identificador.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.alias('value');

Reinicia el estado de identidad actual de RudderStack.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.reset();

Envía los eventos programados de inmediato.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.flush();

Establece el token de empuje que RudderStack envía a los destinos compatibles.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putDeviceToken('value');

Consulte las definiciones de origen para el contrato actual.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAdvertisingId('value');

Establece un valor de identificador de publicidad personalizado.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAdvertisingId('value');

Consulte las definiciones de origen para el contrato actual.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.setAnonymousId('value');

Establece un valor de identificador anónimo personalizado.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.putAnonymousId('value');

Activa/desactiva la opción de exclusión de seguimiento de RudderStack.

import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.optOut(true);

Claves de configuración admitidas para los SDK nativos subyacentes de 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[];
}

Opciones de RudderStack por llamada.

export interface RudderOptions {
/**
* External identifiers forwarded with the event.
*/
externalIds?: Record<string, string>;
/**
* Destination enablement flags keyed by integration name.
*/
integrations?: Record<string, boolean>;
}

Payload de características aceptadas por identify y group.

export type RudderTraits = Record<string, any>;

Propiedades de carga aceptadas por track y screen.

export type RudderProperties = Record<string, any>;

Carga de versión del complemento.

export interface PluginVersionResult {
/**
* Version identifier returned by the platform implementation.
*/
version: string;
}

Niveles de registro de RudderStack expuestos por conveniencia de migración.

export type RudderLogLevelValue = 0 | 1 | 2 | 3 | 4 | 5;

Esta página se genera a partir del plugin’s src/definitions.tsRe-ejecutar la sincronización cuando los archivos públicos API cambian en la fuente.