본문 바로가기

시작하기

GitHub

AI-Assisted Setup으로 플러그인을 설치할 수 있습니다. 다음 명령어로 AI 도구에 Capgo 스킬을 추가하세요:

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

그런 다음 아래 프롬프트를 사용하세요:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-rudderstack` plugin in my project.

수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-rudderstack
bunx cap sync
import { nativePlugin } from '@capgo/capacitor-rudderstack';
import { nativePlugin } from '@capgo/capacitor-rudderstack';
await nativePlugin.initialize({
writeKey: 'YOUR_WRITE_KEY',
dataPlaneUrl: 'https://your.dataplane.rudderstack.com',
});
await nativePlugin.identify({ userId: 'user_123', traits: { plan: 'pro' } });
await nativePlugin.track({ event: 'Signed Up', properties: { source: 'mobile' } });
await nativePlugin.screen({
screen: 'Checkout',
properties: { step: 'payment' },
});

자주 하는 실수

“흔한 실수” 섹션
  • 한 번만 초기화: 반복됨 initialize() 호출 시 SDK 상태가 중복될 수 있으므로, 앱 부트스트랩 단계에서 제어하세요.
  • 백그라운드 전환 전 Flush 실행: 호출 flush() iOS 또는 Android가 업로드 도중 프로세스를 일시 중단할 수 있습니다.
  • 광고 ID: 개인정보 처리방침에 IDFA 또는 GAID 수집 내용이 포함된 경우에만 opt in 도우미를 사용하세요.

RudderStack 클라이언트를 초기화합니다.

이 메서드는 Cordova 시그니처를 유지하므로, 두 번째 인자로 config 객체 또는 Rudder options 객체를 모두 사용할 수 있습니다.

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

제공된 user id로 identify 호출을 보냅니다.

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

제공된 group id로 group 호출을 보냅니다.

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

제공된 이벤트 이름으로 track 호출을 보냅니다.

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

제공된 화면 이름으로 screen 호출을 보냅니다.

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

현재 사용자를 새 식별자로 alias합니다.

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

현재 RudderStack identity 상태를 재설정합니다.

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

대기 중인 이벤트를 즉시 flush합니다.

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

RudderStack이 지원되는 destination으로 전달할 push token을 설정합니다.

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

현재 contract의 소스 정의를 확인하세요.

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

사용자 정의 광고 ID 값을 설정합니다.

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

현재 contract의 소스 정의를 확인하세요.

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

커스텀 익명 ID 값을 설정합니다.

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

RudderStack 트래킹 옵트아웃을 토글합니다.

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

타입 레퍼런스

“타입 참조” 섹션

기반이 되는 RudderStack native SDK에서 지원하는 설정 키입니다.

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

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

다음에서 수락되는 Traits 페이로드: identify 및 group.

export type RudderTraits = Record<string, any>;

다음에서 수락되는 Properties 페이로드: track 및 screen.

export type RudderProperties = Record<string, any>;

플러그인 버전 페이로드.

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

마이그레이션을 위해 제공되는 RudderStack 로그 레벨 값입니다.

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

이 페이지는 플러그인의 src/definitions.tsupstream에서 public API가 변경되면 sync를 다시 실행하세요.

사용 중이라면 시작하기 대시보드 및 API 운영을 계획하려면, 이를 다음과 연결하세요 @capgo/capacitor-rudderstack 사용하기 @capgo/capacitor-rudderstack를 사용하여 네이티브 기능을 구현할 때, API 개요 구현 세부 사항은 API 개요에서 소개 구현 세부 사항은 소개에서 API 키 API Keys의 구현 세부 사항은, 기기 Devices의 구현 세부 사항은.