RemoteCommands Module
Enables triggering of native code blocks from events in Tealium iQ Tag Management, controlled by extensions and load rules.
Learn more about remote commands.
Requirements
- If using the
webview
remote command, the Tag Management Dispatcher module is required. - RemoteCommandDispatcher
1.4.0
and above requirescom.tealium:kotlin-core:1.6.0
as a minimum version.
Install
Install the RemoteCommands Dispatcher module using Maven (recommended) or manually.
Maven
To install the module using Maven:
-
In your project’s top-level
build.gradle
file, add the following Maven repository:maven { url "https://maven.tealiumiq.com/android/releases/" }
-
In your project module’s
build.gradle
file, add the Maven dependencies for the RemoteCommands Dispatcher. This will pull in the Tealium Kotlin library.dependencies { implementation 'com.tealium:kotlin-core:1.6.0' implementation 'com.tealium:kotlin-remotecommand-dispatcher:1.4.0' implementation 'com.tealium:remotecommands:1.0.1' }
Manual
To install the RemoteCommands Dispatcher manually:
-
Download the Tealium Collect Dispatcher module.
-
Copy the file
tealium-kotlin.remotecommand-1.4.0.aar
into your project’s<PROJECT_ROOT>/<MODULE>/libs
directory. -
Add the Tealium library dependency to your project module’s
build.gradle
file:dependencies { implementation(name:'tealium-kotlin.remotecommand-1.4.0', ext:'aar') }
Remote Command Options
There are two configuration options for remote commands:
- JSON File
A JSON file, loaded locally or hosted remotely, containing the vendor settings, data mappings, and event triggers. - Remote Command Tag
A tag in iQ Tag Management that offers configuration options for the vendor’s API (for use with the Tag Management module).
See the list of remote command vendor integrations.
Examples
The Remote Command tag is configurable in Tealium iQ Tag Management, via a JSON file in your app, or JSON file on a remote server. Once the remote command is configured and the module is installed, add the following lines to the initialization:
val config = TealiumConfig(application,
"ACCOUNT",
"PROFILE",
Environment.DEV,
dispatchers = mutableSetOf(Dispatchers.RemoteCommands));
var tealium = Tealium.create(TEALIUM_MAIN, config) {
val remoteCommands = RemoteCommand(this);
// register the command
remoteCommands?.add(remoteCommands);
}
val config = TealiumConfig(application,
"ACCOUNT",
"PROFILE",
Environment.DEV,
dispatchers = mutableSetOf(Dispatchers.RemoteCommands));
var tealium = Tealium.create(TEALIUM_MAIN, config) {
val remoteCommands = RemoteCommand(this);
remoteCommands?.add(remoteCommands, filename = "FILENAME.json");
}
val config = TealiumConfig(application,
"ACCOUNT",
"PROFILE",
Environment.DEV,
dispatchers = mutableSetOf(Dispatchers.RemoteCommands));
var tealium = Tealium.create(TEALIUM_MAIN, config) {
val remoteCommands = RemoteCommand(this);
remoteCommands?.add(remoteCommands, remoteUrl = "https://tags.tiqcdn.com/dle/ACCOUNT/PROFILE/FILENAME.json");
}
After the JSON file has been configured and either added to your app or hosted on a server, learn about the different JSON load options.
Data Layer
No additional variables are introduced by this module.
API Reference
RemoteCommand()
Creates a new remote command object ready to be passed to the add
command.
val remoteCommand = object : RemoteCommand("commandName", "description") {
override fun onInvoke(response: Response) {
Logger.dev(BuildConfig.TAG, "ResponsePayload for webView RemoteCommand ${response.requestPayload}")
}
}
Parameter | Description | Example |
---|---|---|
commandName |
Required String command name | "sample" |
description |
Optional String description of the remote command | "testing RCs" |
add()
Registers a specified remote command with Tealium for later triggering. Tealium must have been initialized before adding a new Remote Command.
val tealium = Tealium.create(instanceName, config) {
remoteCommands?.add(remoteCommand)
}
The following is a usage example:
val remoteCommand = object : RemoteCommand("sample", "testing RCs") {
override fun onInvoke(response: Response) {
Logger.dev(BuildConfig.TAG, "ResponsePayload for webView RemoteCommand ${response.requestPayload}")
}
}
val tealium = Tealium.create(instanceName, config) {
remoteCommands?.add(remoteCommand)
}
remove()
Removes a previously registered remote command to prevent it from being triggered again.
val tealium = Tealium.create(instanceName, config) {
remoteCommands?.remove("commandName")
}
removeAll
Removes all previously registered remote commands.
val tealium = Tealium.create(instanceName, config) {
remoteCommands?.removeAll()
}
This page was last updated: May 15, 2024