---
title: Getting Started with Experience Analytics - iOS
description: Integrate the CSQ SDK for Experience Analytics into your iOS app in minutes
lastUpdated: 01 September 2026
source_url:
  html: https://docs.contentsquare.com/fr/csq-sdk-ios/experience-analytics/
  md: https://docs.contentsquare.com/fr/csq-sdk-ios/experience-analytics/index.md
---

> Documentation index: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

Note

Cette page est affichée en anglais car elle n'est pas disponible dans votre langue.

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

## AI-assisted setup

Use the Contentsquare wizard or skills to set up, update, and configure iOS with your AI coding assistant.

Disclaimer

This skill guides your AI coding agent through the SDK installation and implementation. The agent you use (Cursor, Claude Code, Copilot) is your own tool and operates under your settings and permissions. Contentsquare is not responsible for how your agent interprets or applies the instructions contained in these files.

### Contentsquare wizard

Run the wizard in your project directory. It configures your AI coding assistant, installs the matching Contentsquare integration, and verifies the installation.

```shell
npx @contentsquare/wizard install
```

Supports GitHub Copilot, Cursor, and Claude Code. Requires Node.js ≥ 18 and an AI coding agent with MCP support.

### Configure assistant manually

Use this path when you prefer to configure your AI coding assistant yourself.

#### 1. Add the Contentsquare skill

Choose how to install the Contentsquare skill.

* Copilot CLI

  Add the Contentsquare marketplace, then install the plugin for iOS:

  ```shell
  copilot plugin marketplace add ContentSquare/agents
  copilot plugin install contentsquare-ios@contentsquare
  ```

* Claude Code

  Add the Contentsquare marketplace, then install the plugin for iOS:

  ```shell
  /plugin marketplace add ContentSquare/agents
  /plugin install contentsquare-ios@contentsquare
  ```

* Cursor

  Install **contentsquare** from the [Cursor marketplace ↗](https://cursor.com/marketplace), or add the [Contentsquare agents repository ↗](https://github.com/ContentSquare/agents) directly. Cursor reads the `.cursor-plugin` catalog in the repository.

* Other agents

  Install the Contentsquare skill pack with the open `skills.sh` ecosystem:

  ```shell
  npx skills add contentsquare/agents
  ```

* From source

  Download or clone the [Contentsquare agents repository ↗](https://github.com/ContentSquare/agents), then copy `skills/contentsquare-ios-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

After installing the skill, paste this prompt into your AI coding assistant:

```text
Install Contentsquare for iOS.
```

Prefer to set things up manually? Continue with the steps below.

## Manual setup

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.

### Before you begin

This guide assumes you are using Xcode with [Swift Package Manager ↗](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app) to manage external dependencies.

### Install the SDK

CocoaPods support is ending

CocoaPods trunk becomes read-only on December 2, 2026. After this date, Contentsquare will no longer publish new SDK versions via CocoaPods. [Migrate to Swift Package Manager (SPM)](https://docs.contentsquare.com/en/csq-sdk-ios/migrate-from-cocoapods/) to continue receiving updates.

1. In your Xcode project > `Package Dependencies`, add this repository location:

   ```plaintext
   https://github.com/ContentSquare/apple-sdk.git
   ```

2. Set the Dependency Rule to `Exact Version` `1.12.3`.

3. Select `Add Package`.

4. To ensure the library can start properly, add `-ObjC` as a linker flag under `Build Settings` > `Linking - General` > `Other Linker Flags`.

### Start the SDK

1. Import the `ContentsquareSDK` module in `AppDelegate`:

   **AppDelegate.swift**

   ```swift
   import UIKit
   import ContentsquareSDK


   @UIApplicationMain
   class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?


     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
       ...
     }
   }
   ```

2. Add a call to `CSQ.start()`:

   * Experience Analytics

     **AppDelegate.swift**

     ```swift
     import UIKit
     import ContentsquareSDK


     @UIApplicationMain
     class AppDelegate: UIResponder, UIApplicationDelegate {
       var window: UIWindow?


       func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         CSQ.start()
         return true
       }


     }
     ```

   * CSQ Experience Platform (Early Access)

     **AppDelegate.swift**

     ```swift
     import UIKit
     import ContentsquareSDK


     @UIApplicationMain
     class AppDelegate: UIResponder, UIApplicationDelegate {
       var window: UIWindow?


       func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         CSQ.start(dataSourceID: "YOUR_DATASOURCE_ID")
         return true
       }


     }
     ```

3. Implement the `optIn()` API to forward user consent to the SDK, generate a user ID, and initiate tracking.

   * Experience Analytics

     ```swift
     import UIKit
     import ContentsquareSDK


     // In viewDidLoad()
     optinButton.addTarget(self, action: #selector(optInButtonTapped), for: .touchUpInside)


     @objc func optInButtonTapped(_ sender: UIButton) {
       CSQ.start()
       CSQ.optIn()
       // Continue with post-consent navigation or UI update
     }
     ```

   * CSQ Experience Platform (Early Access)

     ```swift
     import UIKit
     import ContentsquareSDK


     // In viewDidLoad()
     optinButton.addTarget(self, action: #selector(optInButtonTapped), for: .touchUpInside)


     @objc func optInButtonTapped(_ sender: UIButton) {
       CSQ.start(dataSourceID: "YOUR_DATASOURCE_ID")
       CSQ.optIn()
       // Continue with post-consent navigation or UI update
     }
     ```

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

   ```text
   [INFO] CSQ 1.12.3 for Experience Analytics is attempting to start.
   ```

### Track your first screens

Contentsquare aggregates the user behavior and engagement at the screen level. Start your SDK implementation by tracking key screens like the home screen, product list, product details, or conversion funnel.

Once tracking 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.

Contentsquare 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)

As a general rule of thumb, you should send your screenviews in `viewWillAppear(_ animate: Bool)` when using UIKit, in `.onAppear()` when using SwiftUI.

```swift
import ContentsquareSDK


CSQ.trackScreenview(String, cvars: [CustomVar] = [])
```

For more information see [Implementation recommendations](track-screens/#implementation-recommendations)

## 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.


```json
{"@context":"https://schema.org","@type":"TechArticle","headline":"Getting Started with Experience Analytics","description":"Integrate the CSQ SDK for Experience Analytics into your iOS app in minutes","url":"https://docs.contentsquare.com/fr/csq-sdk-ios/experience-analytics/","inLanguage":"en","dateModified":"2026-09-01T10:25:29+02:00","publisher":{"@type":"Organization","name":"Contentsquare","url":"https://www.contentsquare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://docs.contentsquare.com/#website","name":"Documentation technique Contentsquare","url":"https://docs.contentsquare.com/"}}
```