---
title: Getting Started with Experience Analytics - Flutter
description: Integrate the CSQ SDK for Experience Analytics into your Flutter app in minutes
lastUpdated: 23 January 2026
source_url:
  html: https://docs.contentsquare.com/en/csq-sdk-flutter/experience-analytics/
  md: https://docs.contentsquare.com/en/csq-sdk-flutter/experience-analytics/index.md
---

This quick start guide shows you how to get Contentsquare Experience Analytics set up in a Flutter application.

After completing the setup process, you'll be able to take full advantage of the CSQ API to collect data from your app, within just a few minutes.

Upgrading

See our guide to upgrade to the CSQ SDK from the [CS SDK](upgrade-from-cs-sdk/).

## Install the SDK

With Flutter CLI:

```shell
flutter pub add contentsquare
```

This will add a line like this to your package's `pubspec.yaml` (and run an implicit flutter pub get):

```yaml
dependencies:
flutter:
  sdk: flutter
contentsquare: ^4.1.0
```

## Start the SDK

1. Import the SDK:

   ```dart
   import 'package:contentsquare/csq.dart';
   ```

2. Add a call to star SDK as soon soon as possible in your app, ideally in the `main()` function.

   ```dart
   import 'package:contentsquare/csq.dart';


   void main() async {
    await CSQ().start();
   }
   ```

3. Start your application, and check logs for this output:

   ```text
   ┌───────────────────────────────────────────────────────────────────────────────
   │ 🔔 IMPORTANT 🔔 (CSLIB 4.1.0)
   ├───────────────────────────────────────────────────────────────────────────────
   │ Contentsquare Flutter SDK 4.1.0 starting in app:
   │ com.example.testapp
   └───────────────────────────────────────────────────────────────────────────────
   ```

## Get user consent

Implement the [`optIn()`](command-reference/#csqoptin) 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:

```dart
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:

```dart
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'),
        ),
      ),
    );
  }
}
```

## Track your first screens

Once SDK has started, you're able to take full advantage of the CSQ SDK API to track screen views, monitor user interactions, and capture app behavior data.

CSQ Experience Analytics also comes with powerful Session Replay and Error Monitoring capabilities as paid options.

### Sending screenview events

Screen tracking is achieved by sending a `screenview` event:

* Right after the SDK has started
* When the screen appears
* When a modal/pop-up is closed and the user is back on the screen
* When the app is put in the foreground (after an app hide)

```dart
import 'package:contentsquare/csq.dart';


CSQ().trackScreenview(screenName: 'ScreenName');
```

For more information see [Track screens](track-screens/).

## Next Steps

While screen tracking gives an overview of user navigation, capturing session, screen, or user metadata provides a deeper understanding of the context behind user behavior.

Our SDK offers a wide range of features to enhance your implementation, including Session Replay, Error Monitoring, extended tracking capabilities, and personal data masking.

Proceed with these how-to’s to refine your implementation.

[Custom Variables ](track-custom-variables/)Collect additional details about the screen or the user.

[Dynamic Variables ](track-dynamic-variables/)Collect additional information about the session.

[Transactions tracking ](track-transactions/)Associate user’s session with their potential purchases and corresponding revenue.

[WebViews ](track-webviews/)For native apps which embark web applications or pages.

[Session Replay ](session-replay/)Collect data for Session Replay in compliance personal data masking.

[Error Analysis ](error-analysis/)Track API errors and application crashes with automated collection and privacy-safe debugging tools.
