Getting Started with Experience Analytics
This quick start guide shows you how to get Contentsquare Experience Analytics set up in an iOS application.
AI-assisted setup
Section titled AI-assisted setupUse the Contentsquare wizard or skills to set up, update, and configure iOS 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 iOS:
copilot plugin marketplace add ContentSquare/agentscopilot plugin install contentsquare-ios@contentsquareAdd the Contentsquare marketplace, then install the plugin for iOS:
/plugin marketplace add ContentSquare/agents/plugin install contentsquare-ios@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-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
Section titled 2. Ask your AI coding assistantAfter installing the skill, paste this prompt into your AI coding assistant:
Install Contentsquare for iOS.Prefer to set things up manually? Continue with the steps below.
Manual setup
Section titled Manual setupAfter 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
Section titled Before you beginThis guide assumes you are using Xcode with Swift Package Manager ↗ to manage external dependencies.
Install the SDK
Section titled Install the SDK-
In your Xcode project >
Package Dependencies, add this repository location:https://github.com/ContentSquare/apple-sdk.git -
Set the Dependency Rule to
Exact Version1.12.3. -
Select
Add Package. -
To ensure the library can start properly, add
-ObjCas a linker flag underBuild Settings>Linking - General>Other Linker Flags.
Start the SDK
Section titled Start the SDK-
Import the
ContentsquareSDKmodule inAppDelegate:AppDelegate.swift import UIKitimport ContentsquareSDK@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {var window: UIWindow?func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {...}} -
Add a call to
CSQ.start():- Experience 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.
AppDelegate.swift import UIKitimport ContentsquareSDK@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {var window: UIWindow?func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {CSQ.start()return true}}AppDelegate.swift import UIKitimport ContentsquareSDK@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {var window: UIWindow?func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {CSQ.start(dataSourceID: "YOUR_DATASOURCE_ID")return true}} -
Implement the
optIn()API to forward user consent to the SDK, generate a user ID, and initiate tracking.- Experience 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.
import UIKitimport 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}import UIKitimport 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} -
Start your application, and check logs for this output:
[INFO] CSQ 1.12.3 for Experience Analytics is attempting to start.
Track your first screens
Section titled Track your first screensContentsquare 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
Section titled Sending screenview eventsScreen 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.
import ContentsquareSDK
CSQ.trackScreenview(String, cvars: [CustomVar] = [])For more information see Implementation recommendations
Next Steps
Section titled Next StepsWhile 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.

