Getting Started
Add Contentsquare to your app
Section titled Add Contentsquare to your appOur iOS SDK is shipped as a .xcframework
which you need to add as a dependency of your project.
How to include it
Section titled How to include itThe SDK requires Xcode 14.1 or later, if you are using older versions of Xcode reach out to your Contentsquare contact for more information.
-
For iOS 13 and later, add the following link via
File > Add Packages…
in XCode: -
Remove
https://github.com/apple/swift-protobuf.git
if you have added it prior to version 4.35.1. -
To ensure the library can start properly you will need to add
-ObjC
as a linker flag underBuild Settings
>Linking
>Other Linker Flags
.
Static linking is the default behavior with use_frameworks!
.
-
Add the following line to your Podfile:
-
Remove
pod 'SwiftProtobuf', '<= 1.26.0'
if you have added it prior to version 4.35.1. -
For iOS 13 and later, add the following line to your Podfile:
Known Issues
Section titled Known Issues-
Updating
IPHONEOS_DEPLOYMENT_TARGET
in yourpost_install
may have the following error.Workaround: Skip updating IPHONEOS_DEPLOYMENT_TARGET for SwiftProtobuf by following these steps.
-
Update your
post_install
to: -
Rerun
pod install
. -
Clean Builder Folder.
-
Rebuild.
-
Not yet supported.
Start the SDK
Section titled Start the SDKAutomatic start (default)
Section titled Automatic start (default)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.
Manual start
Section titled Manual startIf 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:
Then just call start
in the application:didFinishLaunchingWithOptions:
of your UIApplicationDelegate
like this:
When you call the start method, the SDK automatically starts tracking users’ interactions with the app (gestures, lifecycle events and crashes).
Validate SDK integration
Section titled Validate SDK integrationWhen the SDK starts, you should see a log like this one:
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.
Sample App
Section titled Sample AppFor best implementation practices of our library, explore the Contentsquare for iOS sample app ↗.
Use Tealium
Section titled Use TealiumOur 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 ↗.