Saltar al contenido

Empezar

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

Inicializa el cliente de RudderStack.

El método mantiene la firma de Cordova, por lo que el segundo argumento puede ser tanto un objeto de configuración como 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 ID de grupo proporcionado.

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

Envía una llamada de seguimiento 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 nuevo identificador al usuario actual.

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 ID 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 de RudderStack subyacentes.

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 llamada de 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>;
}

Se acepta el payload de características de identify y group.

export type RudderTraits = Record<string, any>;

Se acepta el payload de propiedades de track y screen.

export type RudderProperties = Record<string, any>;

Se acepta el payload de versión del plugin.

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

Niveles de registro de RudderStack expuestos para 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 el público API cambie en la fuente.