コンテンツにジャンプ

Getting Started

GitHub

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

__CAPGO_KEEP_0__スキルをAIツールに追加するには、以下のコマンドを実行してください:
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-gtm` plugin in my project.

コピー

Manual セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の説明を参照してください:
bun add @capgo/capacitor-gtm
bunx cap sync

コピー

Import
import { GoogleTagManager } from '@capgo/capacitor-gtm';

コピー、APIの概要

APIの概要

initialize

初期化

指定されたコンテナIDでGoogleタグマネージャーを初期化します。

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

クリップボードにコピー

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

GoogleタグマネージャーdataLayerから値を取得します。 指定されたキーに対する最新の値をdataLayerを検索します。

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

initialize

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

Google Tag Manager インスタンスをリセットし、すべてのデータをクリアします。 データレイヤーからすべてのデータを削除し、再度初期化する必要があります。

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

このページはプラグインの src/definitions.tsパブリック API がアップストリームで変更された場合に、再度同期を実行してください。

Capacitor を使用している場合 Getting Started ダッシュボードとAPIの作業を計画するには、 Using @capgo/capacitor-gtm Using @capgo/capacitor-gtm APIの概要 APIの実装詳細 導入 __CAPGO_KEEP_0__のキー APIの実装詳細 for the implementation detail in API Keys, and __CAPGO_KEEP_0__の実装詳細 ページを編集