Get started

Add the contentsquare package in your pubspec.yaml:

pubspec.yaml
dependencies:
flutter:
sdk: flutter
contentsquare: ^3.15.1

then run

Terminal window
flutter pub get

To ensure optimal compatibility, make sure you respect the iOS compatibility documentation.

The plugin works out of the box.

The Contentsquare plugin is designed to function seamlessly during the app’s build process. For applications targeting unsupported platforms, the Contentsquare plugin will be automatically disabled with no further actions required. This eliminates potential conflicts and ensures a smooth build experience.

If you need support for a specific platform, reach out to your Contentsquare contact.

Wrap the entire application inside the ContentsquareRoot widget:

main.dart
import 'package:flutter/material.dart';
import 'package:contentsquare/contentsquare.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ContentsquareRoot( // <-- Wrap the entire app inside the ContentsquareRoot widget imported from 'package:contentsquare/contentsquare.dart'
child: MaterialApp(
title: 'My Flutter App',
home: Home()
),
);
}
}

Once you have wrapped your application with the ContentsquareRoot widget, you will be able to access all Contentsquare API using Contentsquare().

If you want more control over when the SDK starts, refer to the manual SDK start guide.

When your application starts, your should see the following log:

┌───────────────────────────────────────────────────────────────────────────────
│ 🔔 IMPORTANT 🔔 (CSLIB 3.15.1)
├───────────────────────────────────────────────────────────────────────────────
│ Contentsquare Flutter SDK 3.15.1 starting in app:
│ your.application.package
└───────────────────────────────────────────────────────────────────────────────

With the SDK now integrated into your app, it’s time to implement calls to track screen views, transactions, and other events. Continue following this guide to learn how.

Currently, only Flutter application on the following platforms are supported by the Contentsquare Flutter SDK:

  • Android
  • iOS

Calling the SDK on other platforms is safe but will not have any effect.

If you need to use the SDK on another platform, contact our support team.

If you encounter any issues, refer to the troubleshooting guide.