Remote Command: Contentsquare
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.1.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
We recommend using one of the following dependency managers for installation:
If you are using the Tealium iOS (Objective-C) library, use the manual installation method. The CocoaPods and Carthage options are only available if you are using the Tealium iOS (Swift) library.
To install Contentsquare remote commands for iOS using CocoaPods:
Remove
tealium-swift
andpod "CS_iOS_SDK"
if they already exist your Podfile. The dependency fortealium-swift
is already included in theTealiumContentsquare
framework.Add the following dependency to your Podfile:
pod "TealiumContentsquare"
The
TealiumContentsquare
pod includes the followingTealiumSwift
dependencies:'tealium-swift/Core' 'tealium-swift/TealiumDelegate' 'tealium-swift/TealiumRemoteCommands' 'tealium-swift/TealiumTagManagement'
Import the modules
TealiumSwift
andTealiumContentsquare
in yourTealiumHelper
file, and any other files that access theTealium
class, or the Contentsquare Remote Command.
To install Contentsquare remote commands for iOS using Carthage:
Remove
tealium-swift
from your Cartfile. The dependency fortealium-swift
is already included in theTealiumContentsquare
framework.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.
To install Contentsquare remote commands for Android using Maven:
Install Tealium for Android (Kotlin) or Tealium for Android (Java) and add the Tealium Maven URL to your project’s top-level
build.gradle
file, if you haven’t done so already.allprojects { repositories { jcenter() 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.gradle
file:dependencies { implementation 'com.tealium.remotecommands:contentsquare:2.0.0' }
Manual (iOS)
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
Sources
folder into your project.Add
Dispatchers.RemoteCommands
as a dispatcherSet the
remoteAPIEnabled
configuration flag totrue
Initialize
For all Tealium libraries, register the Contentsquare remote commands when you initialize.
Android (Kotlin)
Initialize remote commands with a JSON configuration file or the Remote Command tag for Tealium’s Android (Java) library.
The following code is designed for use with the JSON Remote Commands feature, using the local file option:
val config = TealiumConfig(application,
"ACCOUNT",
"PROFILE",
Environment.DEV,
dispatchers = mutableSetOf(Dispatchers.RemoteCommands));
var tealium = Tealium.create(TEALIUM_MAIN, config) {
// Initialize with `Application` in order 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
remoteCommands?.add(contentsquare, filename = "contentsquare.json");
}
The following code is designed for use with the Remote Command tag feature:
val config = TealiumConfig(application,
"ACCOUNT",
"PROFILE",
Environment.DEV,
dispatchers = mutableSetOf(Dispatchers.RemoteCommands));
var tealium = Tealium.create(TEALIUM_MAIN, config) {
// Initialize with `Application` in order 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
remoteCommands?.add(contentsquare);
}
Android (Java)
The JSON Remote Command file feature for Android is only available in the Kotlin SDK.
The following code is designed for use with the Remote Command tag feature:
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` in order 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);
iOS (Swift)
Initialize remote commands with a JSON configuration file or the Remote Command tag for Tealium’s iOS (Swift) library.
The following code is designed for use with the JSON Remote Commands feature, using the local file option:
var tealium : Tealium?
let config = TealiumConfig(account: "ACCOUNT",
profile: "PROFILE",
environment: "ENVIRONMENT",
dataSource: "DATASOURCE",
optionalData: nil)
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
}
let contentsquare = ContentsquareRemoteCommand(type: .local(file: "contentsquare"))
remoteCommands.add(contentsquare)
}
The following code is designed for use with the Remote Command tag feature:
var tealium : Tealium?
let config = TealiumConfig(account: "ACCOUNT",
profile: "PROFILE",
environment: "ENVIRONMENT",˜˜
dataSource: "DATASOURCE",
optionalData: nil)
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
}
let contentsquare = ContentsquareRemoteCommand()
remoteCommands.add(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",
"price": "purchase.price",
"currency": "purchase.currency",
"transaction_id": "purchase.transaction_id"
},
"commands": {
"screen_title": "sendscreenview",
"dynamic_var": "senddynamicvar",
"transaction": "sendtransaction",
"stop_tracking": "stoptracking",
"resume_tracking": "resumetracking",
"forget_me": "forgetme",
"opt_in": "optin",
"opt_out": "optout"
}
}
Supported Methods
The following Contentsquare methods are triggered using a data mapping in the Contentsquare Remote Command tag using the following Tealium commands:
Remote Command | Contentsquare Method |
---|---|
sendscreenview |
send() |
sendtransaction |
send() |
senddynamicvar |
send() |
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 |
Contentsquare Developer Guide: Analytics User IDs
Track Transactions
Remote Command | Contentsquare Method |
---|---|
sendtransaction |
send |
Parameter | Type |
---|---|
price (required) |
Double or Float |
currency (required) |
Int |
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
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
Was this article helpful?
This page was last updated: March 16, 2022