Skip to main content
@capgo/capacitor-contentsquare Analytics Open source

Contentsquare Capacitor plugin

Integrate Contentsquare mobile analytics, consent gating, screen tracking, transactions, and session replay controls in Capacitor

Install

bun add @capgo/capacitor-contentsquare bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-contentsquare
  • pnpm add @capgo/capacitor-contentsquare
  • yarn add @capgo/capacitor-contentsquare

Guide

How to use Contentsquare in Capacitor

Using @capgo/capacitor-contentsquare

Internal native bridge contract implemented by Capacitor.

Install

bun add @capgo/capacitor-contentsquare
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { Contentsquare } from '@capgo/capacitor-contentsquare';

API at a glance

Method Description
optIn See the source definitions for current behavior.
optOut See the source definitions for current behavior.
sendScreenName See the source definitions for current behavior.
sendTransaction See the source definitions for current behavior.
sendDynamicVarWithStringValue See the source definitions for current behavior.
sendDynamicVarWithIntValue See the source definitions for current behavior.
onReady See the source definitions for current behavior.
excludeURLForReplay See the source definitions for current behavior.
setPIISelectors See the source definitions for current behavior.
setCapturedElementsSelector See the source definitions for current behavior.
collect See the source definitions for current behavior.

Examples

optIn()

See the API reference for the current contract.

import { Contentsquare } from '@capgo/capacitor-contentsquare';

await Contentsquare.optIn();

optOut()

See the API reference for the current contract.

import { Contentsquare } from '@capgo/capacitor-contentsquare';

await Contentsquare.optOut();

sendScreenName()

See the API reference for the current contract.

import { Contentsquare } from '@capgo/capacitor-contentsquare';

await Contentsquare.sendScreenName({ name: 'example' });

sendTransaction()

See the API reference for the current contract.

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

await Contentsquare.sendTransaction({
  transactionValue: 1,
  transactionCurrency: CurrencyCode.USD,
});

sendDynamicVarWithStringValue()

See the API reference for the current contract.

import { Contentsquare } from '@capgo/capacitor-contentsquare';

await Contentsquare.sendDynamicVarWithStringValue({
  dynVarKey: 'dyn-var-key-123',
  dynVarValue: 'dyn-var-value',
});

sendDynamicVarWithIntValue()

See the API reference for the current contract.

import { Contentsquare } from '@capgo/capacitor-contentsquare';

await Contentsquare.sendDynamicVarWithIntValue({
  dynVarKey: 'dyn-var-key-123',
  dynVarValue: 'dyn-var-value',
});

The table above lists the 11 core methods. Listener and version helpers, and the full contract of each method, are documented in the GitHub repository.

Full reference

Keep going from Using @capgo/capacitor-contentsquare

If you are using Using @capgo/capacitor-contentsquare to plan native plugin work, connect it with @capgo/capacitor-contentsquare for the implementation detail in @capgo/capacitor-contentsquare, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

Contentsquare plugin FAQ

How do I install the Contentsquare plugin in a Capacitor app?

Run "bun add @capgo/capacitor-contentsquare" (or "npm install @capgo/capacitor-contentsquare"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-contentsquare" in your app code.

Does @capgo/capacitor-contentsquare work with React, Vue and Angular?

Yes. Contentsquare is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-contentsquare support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-contentsquare free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-contentsquare/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Contentsquare without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Contentsquare changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo