From f7350d2d1c162f87add2cceef79da8f1e65d6c2d Mon Sep 17 00:00:00 2001 From: Martin Donadieu Date: Wed, 25 Mar 2026 07:41:43 +0100 Subject: [PATCH 1/4] docs: add Contentsquare plugin docs --- astro.config.mjs | 15 ++ public/icons/plugins/contentsquare.svg | 6 + src/config/plugins.ts | 8 + .../docs/plugins/contentsquare/android.mdx | 41 +++++ .../plugins/contentsquare/getting-started.mdx | 75 ++++++++++ .../docs/docs/plugins/contentsquare/index.mdx | 46 ++++++ .../docs/docs/plugins/contentsquare/ios.mdx | 71 +++++++++ src/content/docs/docs/plugins/index.mdx | 5 + .../en/capacitor-contentsquare.md | 140 ++++++++++++++++++ 9 files changed, 407 insertions(+) create mode 100644 public/icons/plugins/contentsquare.svg create mode 100644 src/content/docs/docs/plugins/contentsquare/android.mdx create mode 100644 src/content/docs/docs/plugins/contentsquare/getting-started.mdx create mode 100644 src/content/docs/docs/plugins/contentsquare/index.mdx create mode 100644 src/content/docs/docs/plugins/contentsquare/ios.mdx create mode 100644 src/content/plugins-tutorials/en/capacitor-contentsquare.md diff --git a/astro.config.mjs b/astro.config.mjs index 545af0eee..b589f5001 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -208,6 +208,11 @@ export default defineConfig({ description: 'Microsoft Application Insights analytics plugin', paths: ['docs/plugins/appinsights/**'], }, + { + label: 'Plugin Contentsquare', + description: 'Contentsquare mobile analytics and session replay plugin', + paths: ['docs/plugins/contentsquare/**'], + }, { label: 'Plugin AppsFlyer', description: 'AppsFlyer mobile attribution, analytics, and deep linking plugin', @@ -866,6 +871,16 @@ export default defineConfig({ ], collapsed: true, }, + { + label: 'Contentsquare', + items: [ + { label: 'Overview', link: '/docs/plugins/contentsquare/' }, + { label: 'Getting started', link: '/docs/plugins/contentsquare/getting-started' }, + { label: 'iOS setup', link: '/docs/plugins/contentsquare/ios' }, + { label: 'Android notes', link: '/docs/plugins/contentsquare/android' }, + ], + collapsed: true, + }, { label: 'AppsFlyer', items: [ diff --git a/public/icons/plugins/contentsquare.svg b/public/icons/plugins/contentsquare.svg new file mode 100644 index 000000000..fdcefe8e8 --- /dev/null +++ b/public/icons/plugins/contentsquare.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/config/plugins.ts b/src/config/plugins.ts index b618409d7..010f70190 100644 --- a/src/config/plugins.ts +++ b/src/config/plugins.ts @@ -284,6 +284,14 @@ export const actions = [ title: 'AppInsights', icon: 'ChartBar', }, + { + name: '@capgo/capacitor-contentsquare', + author: 'github.com/Cap-go', + description: 'Track mobile consent, screenviews, transactions, dynamic variables, and session replay with Contentsquare', + href: 'https://github.com/Cap-go/capacitor-contentsquare/', + title: 'Contentsquare', + icon: 'ChartBar', + }, { name: '@capgo/capacitor-app-attest', author: 'github.com/Cap-go', diff --git a/src/content/docs/docs/plugins/contentsquare/android.mdx b/src/content/docs/docs/plugins/contentsquare/android.mdx new file mode 100644 index 000000000..d4f7987a4 --- /dev/null +++ b/src/content/docs/docs/plugins/contentsquare/android.mdx @@ -0,0 +1,41 @@ +--- +title: Android Notes +description: Android-specific validation and behavior notes for the Contentsquare Capacitor 8 plugin. +sidebar: + order: 4 +--- + +Android does not require extra host-app setup for the plugin itself. Once installed and synced, the plugin registers the main Capacitor `WebView`, injects the Contentsquare event bridge, and exposes the documented JavaScript APIs. + +## What the plugin does on Android + +- Registers the Capacitor `WebView` with the native Contentsquare SDK. +- Exposes `optIn`, `optOut`, `sendScreenName`, `sendTransaction`, and dynamic variable APIs. +- Injects replay-related commands such as URL exclusion, PII masking, and captured element selectors. + +## Validation tips + +### Check native logs + +Filter Android Studio `Logcat` with: + +```text +CSLIB +``` + +You should see the native Contentsquare SDK startup message and the WebView bridge registration during app launch. + +### Track a first session + +```ts +await ContentsquarePlugin.optIn(); +await ContentsquarePlugin.sendScreenName('Home'); +``` + +Without at least one screenview, the session is not kept by Contentsquare. + +## Dynamic variable constraints + +- Keys are limited by Contentsquare to 512 characters. +- Values must be either a string or a non-negative integer. +- If you want a value on every session, send it again when the app returns to foreground. diff --git a/src/content/docs/docs/plugins/contentsquare/getting-started.mdx b/src/content/docs/docs/plugins/contentsquare/getting-started.mdx new file mode 100644 index 000000000..2aada31ca --- /dev/null +++ b/src/content/docs/docs/plugins/contentsquare/getting-started.mdx @@ -0,0 +1,75 @@ +--- +title: Getting Started +description: Install and use Contentsquare in a Capacitor 8 app with consent, screenview, transaction, and dynamic variable tracking. +sidebar: + order: 2 +--- + +import { Steps } from '@astrojs/starlight/components'; +import { PackageManagers } from 'starlight-package-managers'; + + +1. **Install the plugin** + + +2. **Sync native projects** + + +3. **Handle user consent** + Contentsquare users are opted out by default. Call `optIn()` only after your consent flow allows tracking. + +4. **Track at least one screen** + Contentsquare discards sessions without a screenview, so send a screen name as soon as a meaningful screen is visible. + + +## Basic usage + +```ts +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', +}); +``` + +## Screenview recommendations + +- Send a screenview whenever a new screen becomes visible. +- Send a fresh screenview when a modal closes and the user returns to the underlying screen. +- Re-send key contextual dynamic variables when the app returns to foreground. + +## Session replay helpers + +```ts +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 + +- For iOS in-app features, complete the extra deeplink wiring in the [iOS setup](/docs/plugins/contentsquare/ios/) page. +- Android requires no extra manifest wiring for the plugin itself; see [Android notes](/docs/plugins/contentsquare/android/) for logging and validation tips. + +## Notes + +- This plugin is a Capacitor 8 community port of the official Contentsquare Capacitor package. +- The JavaScript API matches the current Contentsquare Capacitor docs, while the packaging and native build setup target Capacitor 8. diff --git a/src/content/docs/docs/plugins/contentsquare/index.mdx b/src/content/docs/docs/plugins/contentsquare/index.mdx new file mode 100644 index 000000000..862d73f46 --- /dev/null +++ b/src/content/docs/docs/plugins/contentsquare/index.mdx @@ -0,0 +1,46 @@ +--- +title: "@capgo/capacitor-contentsquare" +description: Contentsquare analytics and session replay integration for Capacitor 8 apps. +tableOfContents: false +next: false +prev: false +sidebar: + order: 1 + label: "Introduction" +hero: + tagline: Add Contentsquare consent handling, screen tracking, transactions, dynamic variables, and session replay hooks to your Capacitor app. + image: + file: ~public/icons/plugins/contentsquare.svg + actions: + - text: Get started + link: /docs/plugins/contentsquare/getting-started/ + icon: right-arrow + variant: primary + - text: Github + link: https://github.com/Cap-go/capacitor-contentsquare/ + icon: external + variant: minimal +--- + +import { Card, CardGrid } from '@astrojs/starlight/components'; + + + + Control Contentsquare collection explicitly with opt-in and opt-out flows. + + + Send screenviews, transactions, and dynamic variables with the same API shape as the official plugin. + + + Configure replay masking, captured selectors, and URL exclusions from JavaScript. + + + Uses Capgo's Capacitor 8 template, Swift Package Manager, CocoaPods, and Java 21 Android builds. + + + Ships with Contentsquare iOS SDK 4.45.4 and Android SDK 4.43.3. + + + Start with the [Getting Started guide](/docs/plugins/contentsquare/getting-started/) and complete the iOS deeplink setup if you need in-app features. + + diff --git a/src/content/docs/docs/plugins/contentsquare/ios.mdx b/src/content/docs/docs/plugins/contentsquare/ios.mdx new file mode 100644 index 000000000..33c27dcbb --- /dev/null +++ b/src/content/docs/docs/plugins/contentsquare/ios.mdx @@ -0,0 +1,71 @@ +--- +title: iOS Setup +description: Configure the required iOS deeplink hooks for Contentsquare in-app features in Capacitor apps. +sidebar: + order: 3 +--- + +Contentsquare tracking starts automatically once the plugin is installed, but iOS in-app features such as SDK logs, screenshot capture, and replay configuration still need the upstream URL handling setup. + +## 1. Add the URL scheme + +Add `cs-$(PRODUCT_BUNDLE_IDENTIFIER)` to your app URL schemes in Xcode or your host app's `Info.plist`. + +```xml +CFBundleURLTypes + + + CFBundleURLSchemes + + cs-$(PRODUCT_BUNDLE_IDENTIFIER) + + + +``` + +## 2. Forward Contentsquare deeplinks + +Wherever your Capacitor host app handles incoming URLs, forward them to the native SDK: + +### AppDelegate + +```swift +import ContentsquareModule + +func application( + _ app: UIApplication, + open url: URL, + options: [UIApplication.OpenURLOptionsKey : Any] = [:] +) -> Bool { + Contentsquare.handle(url: url) + return true +} +``` + +### SceneDelegate + +```swift +import ContentsquareModule + +func scene(_ scene: UIScene, openURLContexts urlContexts: Set) { + if let url = urlContexts.first?.url { + Contentsquare.handle(url: url) + } +} +``` + +### SwiftUI + +```swift +import ContentsquareModule + +.onOpenURL { url in + Contentsquare.handle(url: url) +} +``` + +## 3. Validate the installation + +- Launch the app on a device or simulator. +- Filter Xcode or Console logs with `CSLIB`. +- Open the Contentsquare mobile tooling and trigger in-app features to confirm the deeplink is handled. diff --git a/src/content/docs/docs/plugins/index.mdx b/src/content/docs/docs/plugins/index.mdx index 2b090611e..c7c1c1955 100644 --- a/src/content/docs/docs/plugins/index.mdx +++ b/src/content/docs/docs/plugins/index.mdx @@ -268,6 +268,11 @@ The Updater plugin is the foundation of Capgo Cloud, enabling you to: description="Application insights and analytics using the Apptopia AppInsights SDK." href="/docs/plugins/appinsights/" /> + Date: Thu, 26 Mar 2026 11:02:35 +0100 Subject: [PATCH 2/4] docs: reduce contentsquare tutorial duplication --- .../en/capacitor-contentsquare.md | 122 +++++------------- 1 file changed, 34 insertions(+), 88 deletions(-) diff --git a/src/content/plugins-tutorials/en/capacitor-contentsquare.md b/src/content/plugins-tutorials/en/capacitor-contentsquare.md index 6dec513d7..7220dca84 100644 --- a/src/content/plugins-tutorials/en/capacitor-contentsquare.md +++ b/src/content/plugins-tutorials/en/capacitor-contentsquare.md @@ -4,116 +4,52 @@ locale: en # Complete Tutorial: Using @capgo/capacitor-contentsquare in Capacitor 8 Apps -`@capgo/capacitor-contentsquare` brings the Contentsquare mobile SDK to Capacitor 8 projects with a packaging layer that fits modern Capgo plugins. It lets you manage consent, send screenviews, track transactions, attach dynamic variables, and configure session replay masking from a single JavaScript API. +`@capgo/capacitor-contentsquare` wires the Contentsquare mobile SDK into Capacitor 8 projects with a Capgo-friendly plugin surface. This tutorial focuses on the integration decisions you typically need to make (consent boundaries, naming strategy, event timing, and ownership), while the step-by-step API snippets live in the plugin docs. -## Why use Contentsquare in a Capacitor app? +## Start with the plugin docs -Contentsquare helps product and growth teams understand how users actually move through the app: +- Getting started: [Contentsquare Getting Started](/docs/plugins/contentsquare/getting-started/) +- iOS setup notes: [Contentsquare iOS Setup](/docs/plugins/contentsquare/ios/) +- Android notes: [Contentsquare Android Notes](/docs/plugins/contentsquare/android/) -- Track screen-level behavior across onboarding, discovery, and checkout funnels. -- Associate revenue events with sessions using transaction tracking. -- Segment sessions using dynamic variables such as store, country, experiment bucket, or subscription tier. -- Configure replay masking and capture rules without rewriting native code. +If you only need installation and the basic API examples, those pages are the canonical reference. -## Install the plugin - -Install the package in your Capacitor app, then sync native projects: +## Install and sync (Bun) ```bash bun add @capgo/capacitor-contentsquare bunx cap sync ``` -## Handle consent correctly - -Contentsquare users are opted out by default. After your consent UI grants analytics permission, start collection explicitly: - -```ts -import { ContentsquarePlugin } from '@capgo/capacitor-contentsquare'; - -await ContentsquarePlugin.optIn(); -``` - -If a user revokes consent later: - -```ts -await ContentsquarePlugin.optOut(); -``` - -## Send your first screenview +## Decide what owns consent -At least one screenview is required for a session to be useful in Contentsquare: +Treat consent as a product feature, not an analytics toggle. The simplest rule is: -```ts -await ContentsquarePlugin.sendScreenName('Home'); -``` +- The consent UI (or your privacy layer) is the only code allowed to call `optIn()` or `optOut()`. +- Everyone else can only call tracking methods when the privacy layer says tracking is allowed. -Use stable screen template names rather than highly specific content labels. For example, prefer `Product Detail` over a full product title. +This keeps you from accidentally emitting events before consent is granted. -## Track purchases +## Choose a screen naming strategy -Send the transaction once when the purchase is actually confirmed: +For clean analysis, define names as stable templates (not user-specific content). A practical approach: -```ts -import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare'; - -await ContentsquarePlugin.sendTransaction({ - transactionValue: 49.9, - transactionCurrency: CurrencyCode.EUR, - transactionId: 'order-4901', -}); -``` +- Build a centralized set of constants: `Screen.Home`, `Screen.ProductDetail`, `Screen.Checkout`. +- Keep names consistent across iOS and Android route stacks. +- Reuse names when only parameters change (for example, item ID). -## Add dynamic variables +## Track transactions where the truth happens -Dynamic variables are useful for segmentation: - -```ts -await ContentsquarePlugin.sendDynamicVar({ - dynVarKey: 'ab_variant', - dynVarValue: 'checkout_redesign_b', -}); - -await ContentsquarePlugin.sendDynamicVar({ - dynVarKey: 'loyalty_level', - dynVarValue: 3, -}); -``` - -## Configure replay masking - -Use replay helper APIs when screens contain sensitive content: - -```ts -await ContentsquarePlugin.excludeURLForReplay('/payment/'); - -await ContentsquarePlugin.setCapturedElementsSelector('[data-cs-capture]'); - -await ContentsquarePlugin.setPIISelectors({ - PIISelectors: ['.email', '.credit-card'], - Attributes: [ - { selector: 'input[name="email"]', attrName: 'value' }, - { selector: 'input[name="card"]', attrName: ['value', 'placeholder'] }, - ], -}); -``` - -## iOS in-app features setup - -On iOS, the host app must still expose the URL scheme expected by Contentsquare and forward deeplinks to `Contentsquare.handle(url:)`. Without that step, core tracking still works, but in-app tooling and some debugging features are incomplete. +Only emit purchase tracking once the app has a confirmed result (for example, a server receipt or a finalized payment state). Avoid firing on UI intent (button press) unless you explicitly label it as an attempt. ## Recommended app structure -A simple way to integrate the plugin is to centralize it in an analytics service: +A low-friction way to integrate is to centralize it behind an analytics service and keep the plugin API out of UI components: ```ts import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare'; export class CsAnalyticsService { - async grantConsent() { - await ContentsquarePlugin.optIn(); - } - async trackScreen(name: string) { await ContentsquarePlugin.sendScreenName(name); } @@ -126,15 +62,25 @@ export class CsAnalyticsService { }); } - async setStore(store: string) { + async setContext(key: string, value: string | number) { await ContentsquarePlugin.sendDynamicVar({ - dynVarKey: 'store', - dynVarValue: store, + dynVarKey: key, + dynVarValue: value, }); } } ``` +## Replay privacy checklist + +Before enabling replay in production: + +- Decide what should never be captured (inputs, payment fields, identity screens). +- Add capture selectors intentionally (favor explicit allow-listing). +- Keep the selector list owned by the same team that owns privacy compliance. + +For the specific helper methods, use the examples in the plugin docs. + ## Final notes -This plugin is a Capgo-maintained Capacitor 8 port of the current Contentsquare Capacitor API surface. For the latest product-level guidance around naming strategy, replay, privacy, and mobile debugging, pair this plugin with the official Contentsquare documentation and your own consent policy. +This plugin is a Capgo-maintained Capacitor 8 port of the current Contentsquare Capacitor API surface. Pair it with your existing consent policy and the official Contentsquare documentation for product-level guidance around replay, privacy, and debugging. From 6fe82b47764681dd23d62bed6aa85dc10b11d52b Mon Sep 17 00:00:00 2001 From: Martin Donadieu Date: Fri, 27 Mar 2026 13:54:09 +0100 Subject: [PATCH 3/4] docs: reduce contentsquare tutorial duplication --- .../en/capacitor-contentsquare.md | 48 +++---------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/src/content/plugins-tutorials/en/capacitor-contentsquare.md b/src/content/plugins-tutorials/en/capacitor-contentsquare.md index 7220dca84..730e8505f 100644 --- a/src/content/plugins-tutorials/en/capacitor-contentsquare.md +++ b/src/content/plugins-tutorials/en/capacitor-contentsquare.md @@ -4,7 +4,7 @@ locale: en # Complete Tutorial: Using @capgo/capacitor-contentsquare in Capacitor 8 Apps -`@capgo/capacitor-contentsquare` wires the Contentsquare mobile SDK into Capacitor 8 projects with a Capgo-friendly plugin surface. This tutorial focuses on the integration decisions you typically need to make (consent boundaries, naming strategy, event timing, and ownership), while the step-by-step API snippets live in the plugin docs. +`@capgo/capacitor-contentsquare` wires the Contentsquare mobile SDK into Capacitor 8 projects with a Capgo-friendly plugin surface. This tutorial focuses on the integration decisions you need to make around ownership, privacy, and analytics structure. For installation and API references, use the plugin docs: ## Start with the plugin docs @@ -14,13 +14,6 @@ locale: en If you only need installation and the basic API examples, those pages are the canonical reference. -## Install and sync (Bun) - -```bash -bun add @capgo/capacitor-contentsquare -bunx cap sync -``` - ## Decide what owns consent Treat consent as a product feature, not an analytics toggle. The simplest rule is: @@ -30,46 +23,21 @@ Treat consent as a product feature, not an analytics toggle. The simplest rule i This keeps you from accidentally emitting events before consent is granted. -## Choose a screen naming strategy +## Keep screen names stable For clean analysis, define names as stable templates (not user-specific content). A practical approach: -- Build a centralized set of constants: `Screen.Home`, `Screen.ProductDetail`, `Screen.Checkout`. +- Build a centralized set of constants for route names. - Keep names consistent across iOS and Android route stacks. -- Reuse names when only parameters change (for example, item ID). +- Reuse names when only parameters change, such as an item ID. -## Track transactions where the truth happens +## Track transactions at the source of truth Only emit purchase tracking once the app has a confirmed result (for example, a server receipt or a finalized payment state). Avoid firing on UI intent (button press) unless you explicitly label it as an attempt. -## Recommended app structure - -A low-friction way to integrate is to centralize it behind an analytics service and keep the plugin API out of UI components: - -```ts -import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare'; +## Keep the plugin behind one service -export class CsAnalyticsService { - async trackScreen(name: string) { - await ContentsquarePlugin.sendScreenName(name); - } - - async trackPurchase(total: number, orderId: string) { - await ContentsquarePlugin.sendTransaction({ - transactionValue: total, - transactionCurrency: CurrencyCode.EUR, - transactionId: orderId, - }); - } - - async setContext(key: string, value: string | number) { - await ContentsquarePlugin.sendDynamicVar({ - dynVarKey: key, - dynVarValue: value, - }); - } -} -``` +A low-friction pattern is to centralize Contentsquare behind one analytics service and keep the plugin API out of UI components. That makes it easier to gate calls on consent, keep screen naming stable, and change the implementation later without touching screens. ## Replay privacy checklist @@ -79,8 +47,6 @@ Before enabling replay in production: - Add capture selectors intentionally (favor explicit allow-listing). - Keep the selector list owned by the same team that owns privacy compliance. -For the specific helper methods, use the examples in the plugin docs. - ## Final notes This plugin is a Capgo-maintained Capacitor 8 port of the current Contentsquare Capacitor API surface. Pair it with your existing consent policy and the official Contentsquare documentation for product-level guidance around replay, privacy, and debugging. From 9e783ce0ca8840573e17209807bbc8dbcd12ca4b Mon Sep 17 00:00:00 2001 From: Martin Donadieu Date: Fri, 27 Mar 2026 13:58:21 +0100 Subject: [PATCH 4/4] docs(contentsquare): reduce duplicated templates --- .../plugins/contentsquare/getting-started.mdx | 35 +++++++-------- .../docs/docs/plugins/contentsquare/index.mdx | 45 +++++++++---------- 2 files changed, 36 insertions(+), 44 deletions(-) diff --git a/src/content/docs/docs/plugins/contentsquare/getting-started.mdx b/src/content/docs/docs/plugins/contentsquare/getting-started.mdx index 2aada31ca..d5c65d171 100644 --- a/src/content/docs/docs/plugins/contentsquare/getting-started.mdx +++ b/src/content/docs/docs/plugins/contentsquare/getting-started.mdx @@ -1,28 +1,24 @@ --- title: Getting Started -description: Install and use Contentsquare in a Capacitor 8 app with consent, screenview, transaction, and dynamic variable tracking. +description: Install and use Contentsquare in a Capacitor 8 app with consent gating, screenviews, transactions, and dynamic variables. sidebar: order: 2 --- -import { Steps } from '@astrojs/starlight/components'; -import { PackageManagers } from 'starlight-package-managers'; +## Install (Bun) - -1. **Install the plugin** - +```bash +bun add @capgo/capacitor-contentsquare +bunx cap sync +``` -2. **Sync native projects** - +## Gate tracking on consent -3. **Handle user consent** - Contentsquare users are opted out by default. Call `optIn()` only after your consent flow allows tracking. +Users are opted out by default. Only call `optIn()` after your consent flow allows tracking, and keep `optOut()` in the same privacy layer so UI components do not accidentally emit events. -4. **Track at least one screen** - Contentsquare discards sessions without a screenview, so send a screen name as soon as a meaningful screen is visible. - +## Send a first screenview -## Basic usage +Contentsquare discards sessions that have no screenview. Send a screen name as soon as a meaningful screen is visible (for example after your first route transition settles). ```ts import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare'; @@ -31,6 +27,7 @@ await ContentsquarePlugin.optIn(); await ContentsquarePlugin.sendScreenName('Home'); +// Track a purchase only once the app has a confirmed outcome (receipt / server confirmation). await ContentsquarePlugin.sendTransaction({ transactionValue: 29.99, transactionCurrency: CurrencyCode.EUR, @@ -43,13 +40,13 @@ await ContentsquarePlugin.sendDynamicVar({ }); ``` -## Screenview recommendations +## Screen naming tips -- Send a screenview whenever a new screen becomes visible. -- Send a fresh screenview when a modal closes and the user returns to the underlying screen. -- Re-send key contextual dynamic variables when the app returns to foreground. +- Use stable names (avoid user-specific strings). +- Keep the same naming conventions across iOS and Android navigation stacks. +- When reopening the app, resend key context (screen name and relevant dynamic vars). -## Session replay helpers +## Session replay helpers (optional) ```ts await ContentsquarePlugin.excludeURLForReplay('/checkout/'); diff --git a/src/content/docs/docs/plugins/contentsquare/index.mdx b/src/content/docs/docs/plugins/contentsquare/index.mdx index 862d73f46..12d3ca5ac 100644 --- a/src/content/docs/docs/plugins/contentsquare/index.mdx +++ b/src/content/docs/docs/plugins/contentsquare/index.mdx @@ -1,14 +1,11 @@ --- title: "@capgo/capacitor-contentsquare" description: Contentsquare analytics and session replay integration for Capacitor 8 apps. -tableOfContents: false -next: false -prev: false sidebar: order: 1 label: "Introduction" hero: - tagline: Add Contentsquare consent handling, screen tracking, transactions, dynamic variables, and session replay hooks to your Capacitor app. + tagline: Add Contentsquare consent gating, screen analytics, transactions, dynamic variables, and replay controls to your Capacitor app. image: file: ~public/icons/plugins/contentsquare.svg actions: @@ -22,25 +19,23 @@ hero: variant: minimal --- -import { Card, CardGrid } from '@astrojs/starlight/components'; +This plugin wraps the Contentsquare mobile SDKs and exposes the same JavaScript API shape as the upstream Capacitor package, packaged for Capgo's Capacitor 8 toolchain. - - - Control Contentsquare collection explicitly with opt-in and opt-out flows. - - - Send screenviews, transactions, and dynamic variables with the same API shape as the official plugin. - - - Configure replay masking, captured selectors, and URL exclusions from JavaScript. - - - Uses Capgo's Capacitor 8 template, Swift Package Manager, CocoaPods, and Java 21 Android builds. - - - Ships with Contentsquare iOS SDK 4.45.4 and Android SDK 4.43.3. - - - Start with the [Getting Started guide](/docs/plugins/contentsquare/getting-started/) and complete the iOS deeplink setup if you need in-app features. - - +## What you can do + +- Gate tracking with `optIn()` and `optOut()` from your consent layer. +- Send screenviews with `sendScreenName()` (required for sessions to be kept). +- Track purchases with `sendTransaction()`. +- Enrich sessions with `sendDynamicVar()`. +- Configure replay masking and capture via the replay helper methods. + +## Versions + +- iOS SDK: 4.45.4 +- Android SDK: 4.43.3 + +## Next steps + +- Follow [Getting Started](/docs/plugins/contentsquare/getting-started/) for install plus your first events. +- If you use Contentsquare in-app tooling on iOS, complete [iOS setup](/docs/plugins/contentsquare/ios/). +- For Android validation tips, see [Android notes](/docs/plugins/contentsquare/android/).