Passer à la navigation

Getting Started

GitHub

Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA à l'aide de la commande suivante :

Fenêtre de terminal
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Ensuite, utilisez la prompt 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 :

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

Initialise le client RudderStack.

La méthode conserve la signature Cordova, donc le deuxième argument peut être soit un objet de configuration, soit un objet Rudder options.

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

Envoie un appel d'identification pour l'ID utilisateur fourni.

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

Envoie un appel de groupe pour l'ID de groupe fourni.

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

Envoie un appel de suivi pour le nom de l'événement fourni.

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

Envoie un appel d'écran pour le nom de l'écran fourni.

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

Alias le utilisateur actuel à un nouveau identifiant.

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

Réinitialise l'état d'identité RudderStack actuel.

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

Flushes les événements en file d'attente immédiatement.

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

Définit le jeton de push que RudderStack envoie aux destinations prises en charge.

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

Voir les définitions de source pour le contrat actuel.

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

Définit une valeur de jeton publicitaire personnalisée.

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

Voir les définitions de source pour le contrat actuel.

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

Fixe une valeur d'ID anonyme personnalisée.

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

Activer/désactiver le suivi RudderStack.

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

Clés de configuration prises en charge pour les SDK natifs RudderStack sous-jacents.

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[];
}

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

Payload de traits accepté par identify et group.

export type RudderTraits = Record<string, any>;

Payload de propriétés accepté par track et screen.

export type RudderProperties = Record<string, any>;

Payload de la version du plugin.

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

Niveaux de journalisation RudderStack exposés pour la commodité de la migration.

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

Cette page est générée à partir du plugin’s src/definitions.ts. Re-run la synchronisation lorsque les modifications publiques API se produisent en amont.

Continuez de la section « Getting Started »

Section intitulée « Continuez de Getting Started »

Si vous utilisez Getting Started pour planifier le tableau de bord et les opérations API, connectez-le à Utilisez @capgo/capacitor-rudderstack pour la capacité native dans Utilisez @capgo/capacitor-rudderstack, Vue d'ensemble de API pour les détails d'implémentation dans Vue d'ensemble de API, Introduction pour les détails d'implémentation dans Introduction, Clés de API pour les détails d'implémentation dans Clés de API, Appareils pour le détail d'implémentation dans Appareils.