Getting Started with Product Analytics
Use this quick start guide to set up the CSQ Product Analytics SDK in a Flutter application.
AI-assisted setup
Section titled AI-assisted setupUse the Contentsquare wizard or skills to set up, update, and configure Flutter with your AI coding assistant.
Contentsquare wizard
Section titled Contentsquare wizardRun the wizard in your project directory. It configures your AI coding assistant, installs the matching Contentsquare integration, and verifies the installation.
npx @contentsquare/wizard installSupports GitHub Copilot, Cursor, and Claude Code. Requires Node.js ≥ 18 and an AI coding agent with MCP support.
Configure assistant manually
Section titled Configure assistant manuallyUse this path when you prefer to configure your AI coding assistant yourself.
1. Add the Contentsquare skill
Section titled 1. Add the Contentsquare skillChoose how to install the Contentsquare skill.
Add the Contentsquare marketplace, then install the plugin for Flutter:
copilot plugin marketplace add ContentSquare/agentscopilot plugin install contentsquare-flutter@contentsquareAdd the Contentsquare marketplace, then install the plugin for Flutter:
/plugin marketplace add ContentSquare/agents/plugin install contentsquare-flutter@contentsquareInstall contentsquare from the Cursor marketplace ↗, or add the Contentsquare agents repository ↗ directly. Cursor reads the .cursor-plugin catalog in the repository.
Install the Contentsquare skill pack with the open skills.sh ecosystem:
npx skills add contentsquare/agentsDownload or clone the Contentsquare agents repository ↗, then copy skills/contentsquare-flutter-sdk into the location your AI coding assistant scans for skills:
| AI coding assistant | Skill location |
|---|---|
| GitHub Copilot | .github/skills/ or .agents/skills/ |
| Cursor | .cursor/rules/ or the project root |
| Claude Code | .claude/skills/ or the project root |
| Other compatible agents | .agents/skills/ |
2. Ask your AI coding assistant
Section titled 2. Ask your AI coding assistantAfter installing the skill, paste this prompt into your AI coding assistant:
Install Contentsquare for Flutter.Prefer to set things up manually? Continue with the steps below.
Manual setup
Section titled Manual setupOnce you've completed the setup process, the CSQ SDK will capture a wide variety of user interactions in your application with no additional code required.
Install the SDK
Section titled Install the SDKWith Flutter CLI:
flutter pub add contentsquareThis will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):
dependencies:flutter: sdk: fluttercontentsquare: ^4.5.1Start the SDK
Section titled Start the SDK-
Import the CSQ SDK in your app:
import 'package:contentsquare/csq.dart'; -
Configure and start the SDK as soon as possible in your app, ideally in the
main()function.- Product Analytics
- CSQ Experience Platform (Early Access)
Get Early Access to CSQ Experience Platform, our latest, all-in-one offering.
Reach out to your Customer Success Manager to join the Early Access Program.
main.dart import 'package:contentsquare/csq.dart';void main() async {await CSQ().start(startConfig: StartConfig.withEnvironmentId(id: 'YOUR_ENVIRONMENT_ID',),);}main.dart import 'package:contentsquare/csq.dart';void main() async {await CSQ().start(startConfig: StartConfig.withDatasourceId(id: 'YOUR_DATASOURCE_ID',),);} -
(Optional) Add
AnalyticsOptions. For example if your Product Analytics environment is hosted in the EU, set thebaseUrloption tohttps://mh.ba.contentsquare.net- Product Analytics
- CSQ Experience Platform (Early Access)
Get Early Access to CSQ Experience Platform, our latest, all-in-one offering.
Reach out to your Customer Success Manager to join the Early Access Program.
main.dart import 'package:contentsquare/csq.dart';void main() async {await CSQ().start(startConfig: StartConfig.withEnvironmentId(id: 'YOUR_ENVIRONMENT_ID',options: AnalyticsOptions(baseUrl: Uri.parse('https://mh.ba.contentsquare.net'),),),);}main.dart import 'package:contentsquare/csq.dart';void main() async {await CSQ().start(startConfig: StartConfig.withDatasourceId(id: 'YOUR_DATASOURCE_ID',options: AnalyticsOptions(baseUrl: Uri.parse('https://mh.ba.contentsquare.net'),),),);} -
Start your application, and check logs for this output:
┌───────────────────────────────────────────────────────────────────────────────│ 🔔 IMPORTANT 🔔 (CSLIB 4.5.1)├───────────────────────────────────────────────────────────────────────────────│ Contentsquare Flutter SDK 4.5.1 starting in app:│ com.example.testapp└─────────────────────────────────────────────────────────────────────────────── -
Recommended To capture screen views automatically, add the
CSQNavigatorObserverto your app's navigator observers:More details in Customize autocaptured screens.main.dart import 'package:contentsquare/csq.dart';MaterialApp(navigatorObservers: [CSQNavigatorObserver(),],home: MyHomePage(),) -
Recommended To enable automatic capture of user interactions, add the option
enableInteractionsAutocapture: trueto yourAnalyticsOptionsconfiguration:- Product Analytics
- CSQ Experience Platform (Early Access)
Get Early Access to CSQ Experience Platform, our latest, all-in-one offering.
Reach out to your Customer Success Manager to join the Early Access Program.
main.dart import 'package:contentsquare/csq.dart';void main() async {await CSQ().start(startConfig: StartConfig.withEnvironmentId(id: 'YOUR_ENVIRONMENT_ID',options: AnalyticsOptions(enableInteractionsAutocapture: true,),),);}main.dart import 'package:contentsquare/csq.dart';void main() async {await CSQ().start(startConfig: StartConfig.withDatasourceId(id: 'YOUR_DATASOURCE_ID',options: AnalyticsOptions(enableInteractionsAutocapture: true,),),);}
Get user consent
Section titled Get user consentImplement the optIn() API to forward user consent to the SDK and generate a user ID.
The CSQ SDK treats users as opted-out by default.
It can be done immediately after start is called:
void main() async { // ... await CSQ().start(); await CSQ().optIn(); // ...}Alternatively, you can call optIn() in response to a user action, such as tapping an "I agree" button:
class UserConsentScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('User Consent'), ), body: Center( child: ElevatedButton( onPressed: () async { await CSQ().optIn(); }, child: Text('Agree with Terms and Conditions'), ), ), ); }}Next steps
Section titled Next stepsOur SDK offers a wide range of features to enhance your implementation, including extended tracking capabilities, and personal data masking.
Session Replay and Error Monitoring are both available with the Experience Analytics extension, which you can purchase separately.

