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.
インストール
「インストール」のセクションYou can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
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.コピー
bun add @capgo/capacitor-gtmbunx cap syncコピー
Importimport { 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' }});setUserProperty
クリップボードにコピーGoogleタグマネージャーdataLayerから値を取得します。 指定されたキーに対する最新の値をdataLayerを検索します。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.setUserProperty({ key: 'user_type', value: 'premium'});getValue
__CAPGO_KEEP_0__ Overviewinitialize
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.getValue({} as { key: string });reset
「リセット」のセクションGoogle Tag Manager インスタンスをリセットし、すべてのデータをクリアします。 データレイヤーからすべてのデータを削除し、再度初期化する必要があります。
import { GoogleTagManager } from '@capgo/capacitor-gtm';
await GoogleTagManager.reset();真実の源
セクション「真実の源」このページはプラグインの src/definitions.tsパブリック API がアップストリームで変更された場合に、再度同期を実行してください。
Getting Started から続けて
セクション「Getting Started から続けて」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__の実装詳細 ページを編集