Skip to content

Getting Started

설치

설치
터미널 창
bun add @capgo/capacitor-gtm
bunx cap sync
import { GoogleTagManager } from '@capgo/capacitor-gtm';

Google Tag Manager를 지정된 컨테이너 ID와 초기화합니다.

import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.initialize({} as { containerId: string; timeout?: number });

__CAPGO_KEEP_3__ 섹션

import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.push({
event: 'purchase',
parameters: {
value: 99.99,
currency: 'USD'
}
});

Google Tag Manager dataLayer에 사용자 속성을 설정합니다.

import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.setUserProperty({
key: 'user_type',
value: 'premium'
});

Google Tag Manager dataLayer에서 지정된 키의 최신 값을 검색하여 가져옵니다.

import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.getValue({} as { key: string });

Google Tag Manager 인스턴스를 초기화하고 모든 데이터를 삭제합니다.

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

클립보드에 복사

실질적인 출처

Section titled “Source Of Truth” src/definitions.ts. upstream의 API이 변경될 때 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속하는 섹션

Capacitor를 사용하는 경우 Getting Started Capacitor를 사용하여 대시보드와 API를 계획하고 운영하기 위해 연결하세요. Capacitor를 사용하여 @capgo/capacitor-gtm Capacitor를 사용하여 @capgo/capacitor-gtm의 네이티브 기능 API 개요 API 개요의 구현 세부 정보 __CAPGO_KEEP_0__ 개요 소개 API 키 implementation 세부 정보에 대한 API 키 장치 implementation 세부 정보에 대한 장치