For the complete documentation index, see llms.txt.

Product Analytics data capture

Last updated View as MarkdownSet up with AI

Start the SDK and turn on autocapture so a single integration captures both Product Analytics and Experience Analytics data.

  1. Configure and start the SDK with CSQ.start().

    AppDelegate.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(
    environmentID: "YOUR_ENVIRONMENT_ID"
    )
    }
    }
  2. Enable autocapture with .enableNativeAutocapture = true.

    AppDelegate.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(
    environmentID: "YOUR_ENVIRONMENT_ID",
    options: [
    .enableNativeAutocapture: true
    ]
    )
    }
    }
  3. (Optional) If your Product Analytics environment is hosted in the EU, set the baseURL option to "https://mh.ba.contentsquare.net".

    CSQ.start(
    environmentID: "YOUR_ENVIRONMENT_ID",
    options: [
    .baseURL: "https://mh.ba.contentsquare.net"
    ]
    )
  4. Add .disablePageviewAutocapture = true.

    AppDelegate.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(
    environmentID: "YOUR_ENVIRONMENT_ID",
    options: [
    .enableNativeAutocapture: true,
    .disablePageviewAutocapture: true
    ]
    )
    }
    }