Getting Started
-
Install the plugin
Terminal window npm i @capgo/capacitor-contentsquareTerminal window pnpm add @capgo/capacitor-contentsquareTerminal window yarn add @capgo/capacitor-contentsquareTerminal window bun add @capgo/capacitor-contentsquare -
Sync native platforms
Terminal window npx cap syncTerminal window pnpm cap syncTerminal window yarn cap syncTerminal window bunx cap sync -
Review the upstream product configuration
Follow the official Contentsquare Capacitor guide for project keys, replay settings, and dashboard setup.
Basic usage
Section titled “Basic usage”import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare';
await ContentsquarePlugin.optIn();
await ContentsquarePlugin.sendScreenName('Home');
await ContentsquarePlugin.sendTransaction({ transactionValue: 29.99, transactionCurrency: CurrencyCode.EUR, transactionId: 'order-123',});
await ContentsquarePlugin.sendDynamicVar({ dynVarKey: 'store', dynVarValue: 'rome',});Screen naming tips
Section titled “Screen naming tips”- Use stable names instead of user-specific values.
- Keep the same naming conventions across iOS and Android navigation stacks.
- When the app returns to foreground, resend the screen name and any critical dynamic variables.
Replay privacy controls
Section titled “Replay privacy controls”Use the built-in masking helpers to keep sensitive content out of 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' }],});Platform setup
Section titled “Platform setup”- For iOS in-app features, complete the extra deeplink wiring in the iOS setup page.
- Android does not need extra manifest wiring for the plugin itself; see Android notes for logging and validation tips.
- This plugin is a Capacitor 8 community port of the official Contentsquare Capacitor package.
- The JavaScript API stays aligned with the current Contentsquare Capacitor docs, while the packaging and native build setup target Capacitor 8.