Getting Started
インストール手順とフルマークダウンガイドのセットアップ案をコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-gtm`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/gtm/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoの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-gtm` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください:
bun add @capgo/capacitor-gtmbunx cap syncインポート
「インポート」のセクションimport { GoogleTagManager } from '@capgo/capacitor-gtm';API の概要
「API の概要」のセクションinitialize
「initialize」のセクション指定されたコンテナIDでGoogle Tag Managerを初期化します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.initialize({} as { containerId: string; timeout?: number });push
「push」のセクション指定されたイベントをGoogle Tag ManagerのdataLayerにプッシュします。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.push({ event: 'purchase', parameters: { value: 99.99, currency: 'USD' }});setUserProperty
Section titled “setUserProperty”Google Tag Managerのユーザープロパティを設定します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.setUserProperty({ key: 'user_type', value: 'premium'});getValue
Section titled “getValue”Google Tag Managerのデータレイヤーから値を取得します。 データレイヤーを検索して、指定されたキーに対応する最新の値を取得します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.getValue({} as { key: string });Google Tag Managerのインスタンスをリセットし、すべてのデータをクリアします。 データレイヤーからすべてのデータを削除し、再度初期化する必要があります。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.reset();Source Of Truth
Section titled “Source Of Truth”このページはプラグインのソースコードから生成されています。 src/definitions.ts. upstream の API が変更されたときに再度 sync を実行してください。
Getting Started から続けてください。
Getting Started から続けてください。「Getting Started から続けてください。」というセクション あなたが Getting Started を使用している場合 ダッシュボードと API の操作を計画するために、接続してください。 native capability を使用する場合の @capgo/capacitor-gtm native capability を使用する場合の @capgo/capacitor-gtm の実装詳細 API の概要 API の実装詳細 __CAPGO_KEEP_0__ の概要 実装詳細 API キー API キーに関する実装詳細のため、 デバイス デバイスに関する実装詳細のため、