@capgo/capacitor-contentsquare

June 16, 2026 · View on GitHub

Capgo - Instant updates for Capacitor

➡️ Get Instant updates for your App with Capgo

Missing a feature? We’ll build the plugin for you 💪

Capacitor 8 wrapper for the official Contentsquare mobile SDKs.

This package keeps the official Contentsquare Capacitor API shape while updating the plugin packaging for Capacitor 8, Swift Package Manager, and Capgo's standard plugin template.

Documentation

The upstream product documentation is available at docs.contentsquare.com/en/capacitor/.

Compatibility

Plugin versionCapacitor compatibilityNative iOS SDKNative Android SDK
v8..v8..4.45.44.43.3

This is a community Capacitor 8 port. Contentsquare's official package currently targets Capacitor 7, but the documented API surface remains the same.

Install

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/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-contentsquare` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

bun add @capgo/capacitor-contentsquare
bunx cap sync

Usage

import { ContentsquarePlugin, CurrencyCode } from '@capgo/capacitor-contentsquare';

await ContentsquarePlugin.optIn();

await ContentsquarePlugin.sendScreenName('Home');

await ContentsquarePlugin.sendTransaction({
  transactionValue: 10,
  transactionCurrency: CurrencyCode.EUR,
  transactionId: 'order-42',
});

await ContentsquarePlugin.sendDynamicVar({
  dynVarKey: 'store',
  dynVarValue: 'rome',
});

iOS Setup

To enable Contentsquare in-app features on iOS, your host app still needs the upstream deeplink wiring described in the official docs:

  1. Add the cs-$(PRODUCT_BUNDLE_IDENTIFIER) URL scheme to the app.
  2. Forward incoming Contentsquare URLs with Contentsquare.handle(url: url) from your AppDelegate, SceneDelegate, or SwiftUI onOpenURL.

API

Public Contentsquare API for Capacitor applications.

optIn()

optIn() => Promise<void>

Marks the user as opted in and starts tracking.


optOut()

optOut() => Promise<void>

Stops tracking, clears local Contentsquare state, and opts the user out.


sendScreenName(...)

sendScreenName(name: string) => Promise<void>

Sends a screenview event for the current screen.

ParamType
namestring

sendTransaction(...)

sendTransaction(transactionItem: TransactionItem) => Promise<void>

Sends a transaction to Contentsquare.

ParamType
transactionItemTransactionItem

sendDynamicVar(...)

sendDynamicVar(dynamicVarItem: DynamicVarItem) => Promise<void>

Sends a dynamic variable.

The value must be either a string or a non-negative integer.

ParamType
dynamicVarItemDynamicVarItem

excludeURLForReplay(...)

excludeURLForReplay(url: string) => Promise<void>

Excludes URLs matching the provided JavaScript regular expression literal from Session Replay.

Example: "/checkout/".

ParamType
urlstring

setPIISelectors(...)

setPIISelectors(pii: PIIConfig) => Promise<void>

Applies Session Replay masking rules to specific selectors and attributes.

ParamType
piiPIIConfig

setCapturedElementsSelector(...)

setCapturedElementsSelector(elements: string) => Promise<void>

Allows specific elements to be captured even when the current page is masked.

ParamType
elementsstring

Interfaces

TransactionItem

Transaction payload sent to Contentsquare.

PropTypeDescription
transactionValuenumberTransaction value.
transactionCurrencystringISO 4217 currency code.
transactionIdstringOptional transaction identifier.

DynamicVarItem

Dynamic variable payload.

PropTypeDescription
dynVarKeystringContentsquare dynamic variable key.
dynVarValuestring | numberDynamic variable value. Use either a string or a non-negative integer.

PIIConfig

Selector and attribute masking configuration for Session Replay.

PropTypeDescription
PIISelectorsstring[]CSS selectors whose content must be masked.
AttributesPIIAttribute[]Attribute masking rules for specific selectors.

PIIAttribute

Attribute masking rule used by setPIISelectors.

PropTypeDescription
selectorstringCSS selector to match.
attrNamestring | string[]Attribute name or names to mask for matching elements.

Enums

CurrencyCode

MembersValue
USD'USD'
CAD'CAD'
EUR'EUR'
AED'AED'
AFN'AFN'
ALL'ALL'
AMD'AMD'
ARS'ARS'
AUD'AUD'
AZN'AZN'
BAM'BAM'
BDT'BDT'
BGN'BGN'
BHD'BHD'
BIF'BIF'
BND'BND'
BOB'BOB'
BRL'BRL'
BWP'BWP'
BYN'BYN'
BZD'BZD'
CDF'CDF'
CHF'CHF'
CLP'CLP'
CNY'CNY'
COP'COP'
CRC'CRC'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