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 助成インストール機能を使用してプラグインをインストールできます。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
「初期化」セクション指定されたコンテナIDでGoogleタグマネージャーを初期化します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.initialize({} as { containerId: string; timeout?: number });push
「push」セクション指定されたイベントをGoogleタグマネージャーデータレイヤーにプッシュします。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.push({ event: 'purchase', parameters: { value: 99.99, currency: 'USD' }});setUserProperty
ユーザープロパティを設定しますGoogle Tag Manager の dataLayer にユーザープロパティを設定します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.setUserProperty({ key: 'user_type', value: 'premium'});getValue
値を取得しますGoogle Tag Manager の dataLayer から値を取得します。 dataLayer 内の指定されたキーに対する最新の値を検索します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.getValue({} as { key: string });reset
リセットGoogle Tag Manager インスタンスをリセットし、すべてのデータをクリアします。 dataLayer からすべてのデータを削除し、再初期化が必要になります。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.reset();真実の源
クリップボードにコピーこのページはプラグインから生成されています。 src/definitions.ts. upstream の public API が変更されたときに再度 Sync を実行してください。
Getting Started から続けてください。
Getting Started から続けてください。Capacitor を使用している場合 Getting Started Capacitor を使用してダッシュボードと API の操作を計画するには、Capacitor を接続してください。 Capacitor のネイティブ機能を使用するには @capgo/capacitor-gtm を使用してください。 Capacitor のネイティブ機能を使用するには @capgo/capacitor-gtm を使用してください。 API の概要 API の実装詳細 Introduction 導入の実装詳細について API キー API キーに関する実装詳細について、 デバイス デバイスに関する実装詳細について。