Getting Started

Our iOS SDK is shipped as a .xcframework which you need to add as a dependency of your project.

The SDK requires Xcode 14.1 or later, if you are using older versions of Xcode reach out to your Contentsquare contact for more information.

  1. For iOS 13 and later, add the following link via File > Add Packages… in XCode:

    https://github.com/ContentSquare/apple-sdk.git
  2. Remove https://github.com/apple/swift-protobuf.git if you have added it prior to version 4.35.1.

  3. To ensure the library can start properly you will need to add -ObjC as a linker flag under Build Settings > Linking > Other Linker Flags.

By default, you do not need to do anything to start the SDK. Now that the SDK is a dependency of your app, it will autostart itself when your application starts.

If you prefer to control when the SDK starts, you can disable the autostart feature and programmatically start the SDK when needed.

The first step is to add the required key to your Info.plist. The key is CSDisableAutostart of type boolean. To disable the autostart, you need to set its value to true:

  • Disable autostart using Xcode:

  • Disable autostart using a text editor:

    Info.plist
    <key>CSDisableAutostart</key>
    <true/>

Then just call start in the application:didFinishLaunchingWithOptions: of your UIApplicationDelegate like this:

Contentsquare.start()

When you call the start method, the SDK automatically starts tracking users’ interactions with the app (gestures, lifecycle events and crashes).

When the SDK starts, you should see a log like this one:

// success case
Contentsquare SDK v[SDKVersionNumber] starting in app:: [your.bundle.id]
// fail case
// << No public fail log

If the SDK does not seem to work, it might mean that your app’s bundle id is not tied to any Contentsquare project. In that case, you will have to communicate all variants of your app’s identifier to your Contentsquare contact to be added as a project.

Now that the SDK runs in your app, you will want to implement calls to our SDK to track screenviews, track transactions, and more.

For best implementation practices of our library, explore the Contentsquare for iOS sample app.

Our partner Tealium has developed a remote command module to integrate with the Contentsquare SDK. This solution leverages the convenience of iQ Tag Management to configure a native Contentsquare implementation without having to add Contentsquare-specific code to your app.

Follow instructions on Tealium’s documentation: Remote Command for Contentsquare.