スタートガイド
インストール手順と、このプラグインの完全なMarkdownガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-contentsquare`
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/contentsquare/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.
インストール
「インストール」セクション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-contentsquare` plugin in my project.手動セットアップを希望する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:
-
プラグインをインストール
ターミナル npm i @capgo/capacitor-contentsquareターミナル pnpm add @capgo/capacitor-contentsquareターミナル yarn add @capgo/capacitor-contentsquareターミナル bun add @capgo/capacitor-contentsquare -
ネイティブプラットフォームを同期
ターミナル npx cap syncターミナル pnpm cap syncターミナル yarn cap syncターミナル bunx cap sync -
アップストリーム製品の設定を確認してください
公式の Contentsquare Capacitor ガイドに従い、 プロジェクトキー、リプレイ設定、ダッシュボードのセットアップを行ってください。
クイックスタート
「クイックスタート」セクションimport { ContentsquarePlugin } from '@capgo/capacitor-contentsquare';
// Only call optIn() after the user has granted analytics consent.if (userGrantedAnalyticsConsent) { await ContentsquarePlugin.optIn();}よくある落とし穴
「よくある落とし穴」セクション- optIn の前に同意状況を確認してください。
- ダッシュボードキーを設定してください。
- リプレイのプライバシールールに従ってください。
基本的な使い方
「基本的な使い方」セクションimport { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare';
const consentGranted = await requestAnalyticsConsent(); // your CMP / ATT flowif (consentGranted) { await ContentsquarePlugin.optIn();}
await ContentsquarePlugin.sendScreenName('Home');
await ContentsquarePlugin.sendTransaction({ transactionValue: 29.99, transactionCurrency: CurrencyCode.EUR, transactionId: 'order-123',});
await ContentsquarePlugin.sendDynamicVarWithStringValue({ dynVarKey: 'store', dynVarValue: 'rome',});画面名の付け方のヒント
「画面名の命名に関するヒント」セクション- ユーザー固有の値ではなく、不変の名前を使用してください。
- iOSとAndroidのナビゲーションスタック間で、命名規則を統一してください。
- アプリがフォアグラウンドに戻った際は、画面名と重要な動的変数を再送信してください。
Replayのプライバシー設定
「Replayのプライバシー制御」セクション組み込みのマスキングヘルパーを使用して、Session Replayに機密情報が含まれないようにしてください:
await ContentsquarePlugin.excludeURLForReplay('/checkout/');
await ContentsquarePlugin.setCapturedElementsSelector('[data-cs-capture]');
await ContentsquarePlugin.setPIISelectors({ PIISelectors: ['input[type="email"]', '.credit-card'], Attributes: [{ selector: 'input[name="email"]', attrName: 'value' }],});プラットフォームのセットアップ
「プラットフォームのセットアップ」セクション- iOSのアプリ内機能では、追加のディープリンク設定を次の iOSの設定 ページで完了してください。
- Androidでは、プラグイン自体に追加のマニフェスト設定は不要です。次を参照: Androidの注意点 (ロギングとバリデーションのヒント)。
- このプラグインは、公式のContentsquare Capacitor パッケージの Capacitor 8 コミュニティ移植版です。
- JavaScriptの API は最新のContentsquare Capacitor ドキュメントに準拠していますが、パッケージングと Native Build のセットアップは Capacitor 8 を対象としています。
Getting Startedの続きを進める
「Getting Started からの続き」セクション使用している場合 スタートガイド ネイティブプラグインの作業を計画するには、次と連携してください: @capgo/capacitor-contentsquare の使い方 @capgo/capacitor-contentsquare の使用時のネイティブ機能については、 Capgo プラグインディレクトリ Capgo プラグインディレクトリのプロダクトワークフローについては、 Capgo による Capacitor プラグイン Capgo による Capacitor プラグインの実装詳細については、 プラグインの追加または更新 プラグインの追加または更新における実装詳細については、および Ionic Enterprise プラグインの代替案 Ionic Enterprise プラグインの代替案におけるプロダクトワークフローについては。