Remote Command: Contentsquare
Tealium remote command integration for Contentsquare on Android and Swift/iOS.
Requirements
- One of these mobile libraries:
- Tealium for Android-Kotlin (1.0.0+)
- Tealium for Android-Java (5.9.0+ for Contentsquare 1.0.0+ or <5.9.0 for previous versions)
- Tealium for iOS-Swift
- One of these remote command integrations:
- Contentsquare Remote Command JSON File (Requires Android-Kotlin 1.0.0+ or iOS-Swift 2.12.0+)
- Contentsquare Remote Command tag in Tealium iQ Tag Management
How It Works
The Contentsquare integration uses three items:
- The Contentsquare native SDK
- The remote commands module that wraps the Contentsquare methods
- Either the JSON configuration file or Remote Command tag that translates event tracking into native Contentsquare calls
Adding the Contentsquare remote command module to your app automatically installs and builds the required Contentsquare libraries. If you are using a dependency manager installation, there is no need to install the Contentsquare SDK separately.
There are two remote command options: A JSON configuration file, or using iQ Tag Management to configure the mappings. A JSON configuration file is the recommended option for your vendor integration, hosted either remotely or locally within your app. If using iQ Tag Management, add the Remote Command tag for the vendor integration. Learn more about vendor integrations.
Install
Dependency Manager
- In your Xcode project, select File > Add Packages… > Add Package Dependency.
- Enter the repository URL:
https://github.com/tealium/tealium-ios-contentsquare-remote-command. - Configure the version rules. Typically,
Up to next majoris recommended. If the currentTealiumContentSquareversion does not appear in the list, then reset your Swift package cache. - Select the
TealiumContentSquaremodule to install, and select the app target you want the module to be installed in.
If your project has more than one app target and needs TealiumContentSquare module in more app targets, you have to manually add them in the Frameworks, Libraries, and Embedded Content section.
To install TealiumContentSquare in additional app targets:
- Select your Xcode project in the Project Navigator.
- In your Xcode project, select the app target under the TARGETS section.
- Navigate to General > Frameworks, Libraries & Embedded Content and select the
TealiumContentSquaremodule to add it to your app target.
To add additional modules from the Tealium Swift library, follow the Swift Package Manager instructions.
-
Remove
tealium-swiftandpod "CS_iOS_SDK"if they already exist in your Podfile. The dependency fortealium-swiftis already included in theTealiumContentsquareframework. -
Add the following dependency to your Podfile:
pod "TealiumContentsquare"The
TealiumContentsquarepod includes the followingTealiumSwiftdependencies:'tealium-swift/Core' 'tealium-swift/RemoteCommands' -
Import the modules
TealiumSwiftandTealiumContentsquarein yourTealiumHelperfile, and any other files that access theTealiumclass, or the Contentsquare Remote Command.
-
Remove
tealium-swiftfrom your Cartfile. The dependency fortealium-swiftis already included in theTealiumContentsquareframework. -
Remove the following line if it exists in your Cartfile:
github "ContentSquare/CS_iOS_SDK" -
Add the following dependency to your Cartfile:
github "tealium/tealium-ios-contentsquare-remote-command"
Tealium for Swift SDK (version 1.6.5+) requires the TealiumDelegate module to be included with your installation.
-
Install Tealium for Android (Kotlin) or Tealium for Android (Java) and add the Tealium Maven URL to your project’s top-level
build.gradlefile, if you haven’t done so already.allprojects { repositories { mavenCentral() maven { url "https://maven.tealiumiq.com/android/releases/" } } } -
Import both the Contentquare SDK and Tealium-Contentsquare remote commands by adding the following dependencies in your app project’s
build.gradlefile:dependencies { implementation 'com.tealium.remotecommands:contentsquare:2.3.0' }
Manual Installation
The manual installation for Contentsquare remote commands requires the Tealium for Swift library to be installed. To install the Contentsquare remote commands for your iOS project:
-
Install the Contentsquare SDK, if you haven’t already done so.
-
Clone the Tealium iOS Contentsquare remote command repo and drag the files within the
Sourcesfolder into your project. -
Set the
remoteAPIEnabledconfiguration flag totrue.
The manual installation for Contentsquare remote commands requires Tealium for Android (Kotlin) or Tealium for Android (Java) to be installed.
To install the Contentsquare remote commands for your Android project:
-
Add
flatDirto your project rootbuild.gradlefile:allprojects { repositories { mavenCentral() flatDir { dirs 'libs' } } } -
Add
tealium-contentsquare.aarto<PROJECT_ROOT>/<MODULE>/libs. -
Add the Tealium library dependency to your
build.gradlefile:dependencies { implementation(name:'tealium-contentsquare', ext:'aar') }
Initialize
For all Tealium libraries, register the Contentsquare remote commands when you initialize.
Initialize remote commands with a JSON configuration file or the Remote Command tag for Tealium’s iOS (Swift) library:
var tealium : Tealium?
let config = TealiumConfig(account: "ACCOUNT",
profile: "PROFILE",
environment: "ENVIRONMENT",
dataSource: "DATASOURCE")
config.dispatchers = [Dispatchers.TagManagement, Dispatchers.RemoteCommands]
config.remoteAPIEnabled = true // Required to use Remote Commands
tealium = Tealium(config: config) { _ in
guard let remoteCommands = self.tealium?.remoteCommands else {
return
}
// Webview Tag
let contentsquare = ContentsquareRemoteCommand()
// Local JSON
//let contentsquare = ContentsquareRemoteCommand(type: .local(file: "contentsquare"))
// Remote JSON
//let contentsquare = ContentsquareRemoteCommand(type: .remote(url: "https://some.domain.com/contentsquare.json"))
remoteCommands.add(contentsquare)
}
Initialize remote commands with a JSON configuration file or the Remote Command tag for Tealium’s Android (Kotlin) library:
val config = TealiumConfig(application,
"ACCOUNT",
"PROFILE",
Environment.DEV,
dispatchers = mutableSetOf(Dispatchers.RemoteCommands, Dispatchers.TagManagement));
var tealium = Tealium.create(TEALIUM_MAIN, config) {
// Initialize with `Application` to take advantage of consent management and other
// advanced features
val contentsquare = ContentsquareRemoteCommand(this);
// Or for simple tracking, you can initialize without `Application`
val contentsquare = ContentsquareRemoteCommand();
// register the command
// Webview Tag
remoteCommands?.add(contentsquare);
// Local JSON
//remoteCommands?.add(contentsquare, filename = "contentsquare.json");
// Remote JSON
//remoteCommands?.add(contentsquare, remoteUrl = "https://some.domain.com/contentsquare.json");
Initialize remote commands with the Remote Command tag for Tealium’s Android (Java) library:
import com.tealium.remotecommands.contentsquare.ContentsquareRemoteCommand;
Tealium.Config config = Tealium.Config.create(application, "ACCOUNT", "PROFILE", "ENVIRONMENT");
Tealium teal = Tealium.createInstance(TEALIUM_MAIN, config);
// Initialize with `Application` to take advantage of consent management and other
// advanced features
ContentsquareRemoteCommand contentsquare = new ContentsquareRemoteCommand(this);
// Or for simple tracking, you can initialize without `Application`
ContentsquareRemoteCommand contentsquare = new ContentsquareRemoteCommand();
// register the command
teal.addRemoteCommand(contentsquare);
JSON Template
If you are configuring remote commands using a JSON configuration file, refer to the following template to get started. The template includes common mappings used in a standard e-commerce installation. Edit the mappings as needed.
{
"config": {},
"mappings": {
"screen": "screen_name",
"dynamic_var": "dynamic_var",
"user_id": "user_identifier",
"custom_vars": "custom_vars",
"price": "purchase.price",
"currency": "purchase.currency",
"transaction_id": "purchase.transaction_id"
},
"commands": {
"screen_title": "sendscreenview",
"dynamic_var": "senddynamicvar",
"user_identifier": "senduseridentifier",
"transaction": "sendtransaction",
"stop_tracking": "stoptracking",
"resume_tracking": "resumetracking",
"forget_me": "forgetme",
"opt_in": "optin",
"opt_out": "optout"
}
}
Supported Methods
We map a command to each Contentsquare method. To trigger a Contentsquare method, pass the corresponding command in the specified format.
| Remote Command | Contentsquare Method |
|---|---|
sendscreenview |
send() |
sendtransaction |
send() |
senddynamicvar |
send() |
senduseridentifier |
sendUserIdentifier() |
stoptracking |
stopTracking() |
resumetracking |
resumeTracking() |
forgetme |
forgetMe() |
optin |
optIn() |
optout |
optOut() |
Since the Contentsquare SDK is installed alongside the Tealium SDK, trigger any native Contentsquare functionality given the corresponding tag configuration.
SDK Setup
Initialize
The Contentsquare SDK is initialized automatically upon launch.
Contentsquare Developer Guide: Initial SDK Setup
Track Screens
| Remote Command | Contentsquare Method |
|---|---|
sendscreenview |
send |
| Parameter | Type |
|---|---|
screen_name (required) |
String |
custom_vars (optional) |
Array |
Custom Variables Format: Each custom variable object should contain:
index(required):Int- The custom variable indexname(required):String- The custom variable namevalue(required):String- The custom variable value
Contentsquare Developer Guide: Analytics User IDs
Track Transactions
| Remote Command | Contentsquare Method |
|---|---|
sendtransaction |
send |
| Parameter | Type |
|---|---|
price (required) |
Double or Float |
currency (required) |
String |
transaction_id (optional) |
String |
Contentsquare Developer Guide: Track Transactions
Track Dynamic Variables
| Remote Command | Contentsquare Method |
|---|---|
senddynamicvar |
send |
| Parameter | Type |
|---|---|
dynamic_var (required) |
Object |
The dynamic_var parameter takes a JSON object of key-value pairs, where keys are strings and the values are either UInt32 or strings. Examples: {"my_dynamic_string_var_name": "some string value"}, {"my_dynamic_int_var_name": 123}, {"my_dynamic_string_var_name": "some string value," "my_dynamic_int_var_name": 123}.
Contentsquare Developer Guide: Track Dynamic Variables
Track User Identifier
| Remote Command | Contentsquare Method |
|---|---|
senduseridentifier |
sendUserIdentifier |
| Parameter | Type |
|---|---|
user_identifier (required) |
String |
Contentsquare Developer Guide: Track User Identifier
Consent Options
Stop / Resume Tracking
| Remote Command | Contentsquare Method |
|---|---|
stoptracking |
stopTracking |
resumetracking |
resumeTracking |
Contentsquare Developer Guide: Stop / Resume Tracking
Opt In
| Remote Command | Contentsquare Method |
|---|---|
optin |
optIn |
Contentsquare Developer Guide: Opt In
Opt Out
| Remote Command | Contentsquare Method |
|---|---|
optout |
optOut |
Contentsquare Developer Guide: Opt Out
Forget Me
| Remote Command | Contentsquare Method |
|---|---|
forgetme |
forgetMe |
Contentsquare Developer Guide: Forget Me
This page was last updated: June 24, 2025