automator

utui. automator

The automator namespace

Namespaces

call
wait

Methods

(static) addExtension(obj, cb)

Add an extension

Example
utui.automator.addExtension({
  id: 20002,
  status: "active",
  title: "extension title"
}, function (ext_id) {
  console.log(ext_id);
});
// Do something with ext_id
Parameters:
Name Type Description
obj Object

An object containing the extension's config fields

cb function

A callback function with the new extension ID

(static) addItemsToLookupTable(extensionId, array) → {Object}

Add Items to a Lookup Table

Example
utui.automator.addItemsToLookupTable("10", [{name:"my match", "value":"my output", comment:"My note"}]);
Parameters:
Name Type Description
extensionId Number | String

An extension ID

array Array.<Object>

An array of objects containing name|title|comment

Returns:

The current extension Object

Type
Object

(static) addLabel(obj, cb)

Create a label

Example
utui.automator.addLabel({
  title: "My_Label",
  color: "regal-rose"
}, function (new_id, error) {
  console.log("The new label ID is: " + new_id);
});
Parameters:
Name Type Description
obj Object

An object containing the properties

Properties
Name Type Description
title String

Label title.

color String

Label color.

security_list Array.<String>

List of users to add to resource lock.

cb function

Callback function with the ID of the new label

(static) addLoadrule(obj, cb)

Create a load rule

Example
utui.automator.addLoadrule({
  status: "active",
  title: "test",
  0 : {
      filter_0: "test",
      input_0: "dom.domain",
      operator_0: "contains"
  }
}, function (new_id) {
  console.log("The load rule ID is: " + new_id);
});
Parameters:
Name Type Description
obj Object

An object containing the tag config properties

cb function

Callback function with the ID of the new loadrule

(static) addMapping(manageId, obj)

Add a mapping to a tag

Examples
utui.automator.addMapping(12, {
  key: "mapFromKey",         // UTUI data source
  type: "mapFromType",       // Types: js, js_page, meta, cp, qs
  variable: "mapToVariable" // The tag property/destination variable
});
utui.automator.addMapping(12, [{
  key: "mapFromKey",
  type: "mapFromType",
  variable: "mapToVariable"
}, {
  key: "mapFromKey",
  type: "mapFromType",
  variable: "mapToVariable"
}]);
Parameters:
Name Type Description
manageId Number

The tag's ID

obj Object

An object containing the mapping

(static) addTag(obj, cb)

Add a tag

Example
utui.automator.addTag({
  "status": "active",
  "tag_name": "Tealium Generic Tag",
  "loadrule": "1,2",
  "labels": "1,2",
  "notes": "",
  "title": "My Generic Tag",
  "tag_id": "20067"
}, function (tag_id) {
  // The new tag ID can be accessed here
  console.log(tag_id);
});
Parameters:
Name Type Description
obj Object

An object containing the tag config properties

cb function

A function callback containing the new tag's ID

(static) addVariable(obj, cb)

Add a data source

Example
utui.automator.addVariable({
  name:"my_var",
  type:"js",
  description:"none"
}, function (new_id) {
  console.log("The new data source ID is: " + new_id);
});
Parameters:
Name Type Description
obj Object

Data source configuration object

cb function

Callback function

(static) copyAll(type)

Copies all instances of the type passed

Example
utui.automator.copyAll("tag")
Parameters:
Name Type Description
type string

One of the following types:

  • tag
  • datasource
  • loadrule
  • extension
  • label

(static) copyAllDataSources()

Copy All Data Sources. A convenience alias for the copyAll function.

(static) copyAllExtensions()

Copy All Extensions. A convenience alias for the copyAll function.

(static) copyAllLabels()

Copy All Labels. A convenience alias for the copyAll function.

(static) copyAllLoadRules()

Copy All Load Rules. A convenience alias for the copyAll function.

(static) copyAllTags()

Copy All Tags. A convenience alias for the copyAll function.

(static) copyDataSource(datasource_id)

Copy a data source into the clipboard

Examples
utui.automator.copyDataSource(12)
utui.automator.copyDataSource("My Data Source")
Parameters:
Name Type Description
datasource_id number | string | Array.<number> | Array.<string>

ID or Title of the data source to be copied

(static) copyExtension(extension_id)

Copy an extension into the clipboard

Examples
utui.automator.copyExtension(12)
utui.automator.copyExtension("My Extension")
Parameters:
Name Type Description
extension_id number | string

ID or Title of the extension to be copied

(static) copyLabel(label_id)

Copy a label into the clipboard

Example
utui.automator.copyLabel("My_Label")
Parameters:
Name Type Description
label_id number | string

ID of the label to be copied

(static) copyLoadRule(loadrule_id)

Copy a load rule into the clipboard

Example
utui.automator.copyLoadRule("My Load Rule")
Parameters:
Name Type Description
loadrule_id number | string

ID of the load rule to be copied

(static) copyTag(tag_id, recursive)

Copy a tag into the clipboard

Examples
utui.automator.copyTag(12)
utui.automator.copyTag("My Tag")
Parameters:
Name Type Description
tag_id number | string

ID of the tag to be copied

recursive boolean

Boolean flag to enable recursive copying

(static) debugModeOff()

Disable debug/verbose mode

Example
utui.automator.debugModeOff()

(static) debugModeOn()

Enable debug/verbose mode

Example
utui.automator.debugModeOn()

(static) dropTemplate(tag_id)

Drop a tag template

Example
utui.automator.dropTemplate(12);
Parameters:
Name Type Description
tag_id Number

The ID of the tag containing the template to drop

(static) emptyClipboard()

Empties the clipboard object

Example
utui.automator.emptyClipboard()

(static) getAllProfiles(accountopt, objectopt) → {jqXHR}

Get a list of profiles for an account

Example
const gObj = {};
utui.automator.getAllProfiles("tealium", gObj);

// OR

utui.automator.getAllProfiles("tealium")
              .then(function(profiles){// * do stuff here * //})
              .catch(function(error){// * do stuff here * //});
Parameters:
Name Type Attributes Default Description
account String <optional>
"Current

Account" The account to query

object Object <optional>

Object to store profiles

Returns:
Type
jqXHR

(static) getClipboard() → {object}

Returns the clipboard object

Example
utui.automator.getClipboard()
Returns:

Clipboard object

Type
object

(static) getExtensionById(extensionId) → {String}

Lookup an extension using it's Id

Example
var ext_id = utui.automator.getExtensionIdByTitle("My Awesome Extension");
// Do something with ext_id
Parameters:
Name Type Description
extensionId Number | String

The extension's ID

Returns:
Type
String

(static) getExtensionFunctions(extensionId) → {Array.<String>}

Get Extension Instances Ids from Extension Id

Example
utui.automator.getExtensionInstanceIds("10");
Parameters:
Name Type Description
extensionId Number | String

An extension ID

Returns:

The current extension Object

Type
Array.<String>

(static) getExtensionFunctions(extensionId) → {Object}

Get Extension Object from Id

Example
utui.automator.getExtensionFunctions("10");
Parameters:
Name Type Description
extensionId Number | String

An extension ID

Returns:

The current extension Object

Type
Object

(static) getExtensionIdByTitle(extension_title) → {String}

Get Extensions Id by it's title

Example
utui.automator.getExtensionIdByTitle("My Extension");
Parameters:
Name Type Description
extension_title String

The extension title

Returns:
Type
String

(static) getExtensionIdsByLabel(label_name) → {Array}

Get a list of extension IDs by their label

Example
utui.automator.getExtensionIdsByLabel("Red");
Parameters:
Name Type Description
label_name String

The extension label

Returns:
Type
Array

(static) getExtensionIdsByScope(scope) → {Array.<String>}

Get a list of Extension Ids by their scope

Example
utui.automator.getExtensionIdsByScope("global");
Parameters:
Name Type Description
scope 'global' | 'preload' | 'domready' | '<tag id>'

The scope to filter by

Returns:
Type
Array.<String>

(static) getExtensionsByLabel(label_name) → {Array}

Get a list of extension by their label

Example
utui.automator.getExtensionsByLabel("Red");
Parameters:
Name Type Description
label_name String

The extension label

Returns:
Type
Array

(static) getExtensionsWhere(obj) → {Array.<String>}

Query for a list of extensions

Example
utui.automator.getExtensionsWhere({
 "status": "active",   // Status (inactive/active)
 "_id": "1",           // Extension UID
 "all": "yes",         // Unknown
 "sort": 0,            // Sort order (0 = first...)
 "notes": "",          // Text for notes field
 "title": "No Title",  // Friendly title
 "type": "new",        // Type (new, old)
 "id": "100001",       // Extension type (100001 = Lower-Casing)
 "labels": "",         // List of label IDs (Comma delimited w/ no spaces)
 "scope": "global"     // Scope (global, domready, preload, tag_uid)
});
Parameters:
Name Type Description
obj Object

An object containing the properties to look for

Returns:
Type
Array.<String>

(static) getExtensionTemplateById(extension_id) → {Object}

Get details for a particular extension

Example
utui.automator.getExtensionTemplateById(100001);
Parameters:
Name Type Description
extension_id Number | String

The extension template ID

Returns:
Type
Object

(static) getExtensionTemplateByName(extension_name) → {Object}

Get details for a particular extension

Example
utui.automator.getExtensionTemplateByName("Lower-Casing");
Parameters:
Name Type Description
extension_name String

The extension template name

Returns:
Type
Object

(static) getExtensionTypes() → {Object}

Get a list of available extensions

Example
utui.automator.getExtensionTypes();
Returns:
Type
Object

(static) getLabelById(label_id) → {Object}

Lookup label by ID

Example
utui.automator.getLabelById(12);
Parameters:
Name Type Description
label_id String

The label ID

Returns:
Type
Object

(static) getLabelColors() → {Array.<String>}

Get available colors for labels

Example
utui.automator.getLabelColors();
Returns:

List of available supported colors

Type
Array.<String>

(static) getLabelIdByName(label_name) → {Number}

Returns the ID of the first label that matches

Example
utui.automator.getLabelIdByName("My_Label");
Parameters:
Name Type Description
label_name String

The label name

Returns:

Id of label

Type
Number

(static) getLabels() → {Object}

Returns the label data

Example
utui.automator.getLabels();
Returns:
Type
Object

(static) getLabelsByName(label_name) → {Array.<Object>}

Get a list of labels that match a name

Example
utui.automator.getLabelsByName("My_Label");
Parameters:
Name Type Description
label_name String

The label name

Returns:
Type
Array.<Object>

(static) getLoadruleById(id) → {Object}

Get a load rule by ID

Example
utui.automator.getLoadruleById(12);
Parameters:
Name Type Description
id String | Number

The load rule ID

Returns:
Type
Object

(static) getLoadruleContainerById(lr_id) → {Object}

Lookup a load rules's container by it's ID

Example
utui.automator.getLoadruleContainerById(12);
Parameters:
Name Type Description
lr_id Number | String

The load rule ID

Returns:
Type
Object

(static) getLoadruleIdByTitle(title) → {String|Number}

Find the first load rule that matches a title

Example
utui.automator.getLoadruleIdByTitle("My Load Rule");
Parameters:
Name Type Description
title String

The title to match

Returns:
Type
String | Number

(static) getLoadruleIdsByLabel(label_name) → {Array.<String>}

Get a list of load rule IDs by their label

Example
utui.automator.getLoadruleIdsByLabel("Red");
Parameters:
Name Type Description
label_name String

The load rule label

Returns:
Type
Array.<String>

(static) getLoadruleIdsByTitle(title) → {Array}

Find load rule IDs that match a title

Example
utui.automator.getLoadruleIdsByTitle("My Load Rule");
Parameters:
Name Type Description
title String

The title to match

Returns:
Type
Array

(static) getLoadrules() → {Object}

Get a list of load rules

Example
utui.automator.getLoadrules();
Returns:
Type
Object

(static) getLoadrulesByLabel(label_name) → {Array.<Object>}

Get a list of load rules by their label

Example
utui.automator.getLoadrulesByLabel("Red");
Parameters:
Name Type Description
label_name String

The load rule label

Returns:
Type
Array.<Object>

(static) getLoadrulesByTitle(title) → {Array}

Find load rules that match a title

Example
utui.automator.getLoadrulesByTitle("My Load Rule");
Parameters:
Name Type Description
title String

The title to match

Returns:
Type
Array

(static) getTagById(tag_id) → {Object}

Lookup a tag by ID

Example
utui.automator.getTagById(12);
Parameters:
Name Type Description
tag_id Number | String

A tag ID

Returns:
Type
Object

(static) getTagContainerById(tag_id) → {Object}

Lookup a tag's container by it's ID

Example
utui.automator.getTagContainerById(12);
Parameters:
Name Type Description
tag_id Number | String

The tag ID

Returns:
Type
Object

(static) getTagIdByTitle(tag_title) → {String}

Get a tag ID by it's title

Example
utui.automator.getTagIdByTitle("Google Analytics (gtag.js)");
Parameters:
Name Type Description
tag_title String

The tag title

Returns:
Type
String

(static) getTagIdsByLabel(label_name) → {Array}

Get a list of tag IDs by their label

Example
utui.automator.getTagIdsByLabel("Red");
Parameters:
Name Type Description
label_name String

The tag label

Returns:
Type
Array

(static) getTagIdsByTagName(tag_name) → {Array}

Get a list of tag IDs by their title

Example
utui.automator.getTagIdsByTagName("Tealium Generic Tag");
Parameters:
Name Type Description
tag_name String

The tag name

Returns:
Type
Array

(static) getTagIdsByTitle(title) → {Array}

Get a list of tag IDs by their title

Example
utui.automator.getTagIdsByTitle("Red");
Parameters:
Name Type Description
title String

The tag title

Returns:
Type
Array

(static) getTags() → {Object}

Return a list of tags

Example
utui.automator.getTags();
Returns:
Type
Object

(static) getTagsByLabel(label_name) → {Object}

Get a list of tags by their label

Example
utui.automator.getTagsByLabel("Red");
Parameters:
Name Type Description
label_name String

The tag label

Returns:
Type
Object

(static) getTagsByTitle(title) → {Object}

Get a list of tags by their title

Example
utui.automator.getTagsByTitle("My Awesome Tag");
Parameters:
Name Type Description
title String

The tag title

Returns:
Type
Object

(static) getVariable(title) → {Object}

Get a data source

Example
utui.automator.getVariable("my_var");
Parameters:
Name Type Description
title String | Number

The title/name or ID of the data source

Returns:

Data Source Object

Type
Object

(static) getVariableByName(title) → {Object}

Get a data sources by title/name

Example
utui.automator.getVariablesByTitle("my_var");
Parameters:
Name Type Description
title String

The title or name of the data source(s)

Returns:

Data Source Object

Type
Object

(static) getVariableDS(title) → {Object}

Get a data source object

Example
utui.automator.getVariableDS("my_var");
Parameters:
Name Type Description
title String | Number

The title or ID of the data source

Returns:

Data Source Object

Type
Object

(static) getVariableIdsByLabel(label_name) → {Array}

Get a list of variable IDs by their label

Example
utui.automator.getVariableIdsByLabel("Red");
Parameters:
Name Type Description
label_name String

The variable label

Returns:
Type
Array

(static) getVariablesByLabel(label_name) → {Object}

Get a list of variables by their label

Example
utui.automator.getVariablesByLabel("Red");
Parameters:
Name Type Description
label_name String

The variable label

Returns:
Type
Object

(static) help()

Open this documentation

Example
utui.automator.help()

(static) linkProfileToLibrary(libraryName, callBack, environmentopt)

Link a library to the current profile

Example
utui.automator.linkProfileToLibrary("lib-my-tags");
Parameters:
Name Type Attributes Default Description
libraryName String

The name of the library to link

callBack linkProfileToLibraryCallBack

Call back function

environment String <optional>
Prod

The name of the library to link

(static) log(msg, force)

Logs messages to the console if debug mode is on.

Use document.cookie="automatordb=true" to persist debug mode across sessions

Parameters:
Name Type Description
msg String

Message to log

force Boolean

Force log even if debug mode is off

(static) lookupTag(obj)

Lookup a tag object

Examples
utui.automator.lookupTag({_id: "template_id"});
utui.automator.lookupTag({title: "title"});
Parameters:
Name Type Description
obj Object

An object containing the tag config properties

(static) processClipboard(cursor_idxopt, callBackopt)

Process aka "Paste" the contents of the clipboard

Example
utui.automator.processClipboard()
Parameters:
Name Type Attributes Description
cursor_idx Number <optional>

The queue position to start at

callBack function <optional>

Once the queue is done run this function.

(static) removeAllVariables()

Remove all data sources. THERE IS NO CONFIRMATION, SO BE CAREFUL!

Example
utui.automator.removeAllVariables();

(static) removeTag(tag_id)

Remove a tag

Examples
utui.automator.removeTag(12);
utui.automator.removeTag("My Tag Title");
Parameters:
Name Type Description
tag_id Number | String

The tag ID

(static) removeVariable(title)

Remove a data source

Example
utui.automator.removeVariable("my_var");
Parameters:
Name Type Description
title String | Number

The title or ID of the data source

(static) run(queue, handler, delay) → {Promise}

Runs automator and starts processing the queue of accounts/profiles

Example
// Setup list of target profiles with callback handler and publish target
var automatorObject = [
  {account: "ACCOUNT", profile: "PROFILE", dev: false, qa: false, prod: false},
  {account: "ACCOUNT", profile: "PROFILE", dev: false, qa: false, prod: false}
];

var delay = 3000; // 3 second delay

// Callback handler
var automatorHandler = function() {
  // Could do something here.
};

// Run the automator
utui.automator.run(automatorObject, automatorHandler, delay);
Parameters:
Name Type Description
queue Array

Array of accounts/profiles to automate

handler function

Callback handler for each account/profile

delay Number

Number of milliseconds to delay between publishes

Returns:

A promise for chaining

Type
Promise

(static) updateExtensionValue(extensionId, key, value)

Update an extension's value

Example
utui.automator.updateExtensionValue("10", "title", "My new title");
Parameters:
Name Type Description
extensionId Number | String

An extension ID

key String

The name of the value

value String

The new value

(static) updateLoadruleValue(lr_id, key, value)

Update a load rule's conditions

Example
utui.automator.updateLoadruleValue(12, "myVar", "My Value");
Parameters:
Name Type Description
lr_id String | Number

The load rule ID

key String

The name of the load rule condition

value String

The new value to check for

(static) updateLookupTable(extensionId, array) → {Object}

Deprecated:
  • since version 4.6.7

Update a Lookup Table

Example
utui.automator.updateLookupTable("10", [{name:"my match", "value":"my output", comment:"My note"}]);
Parameters:
Name Type Description
extensionId Number | String

An extension ID

array Array.<Object>

An array of objects containing name|title|comment

Returns:

The current extension Object

Type
Object

(static) updatePublishSettings(settings) → {jqXHR}

Update publish settings

Example
utui.automator.updatePublishSettings({domain:"my.domain.com"})
              .then(function(publishSettings){// * do stuff here * //})
              .catch(function(error){// * do stuff here * //});
Parameters:
Name Type Description
settings Object

Settings to update

Returns:
Type
jqXHR

(static) updateTag(tag_uid, obj_new) → {Number}

Update a tag's properties

Example
utui.automator.updateTag(12, {title: "My renamed tag"});
Parameters:
Name Type Description
tag_uid Array

The tag's ID

obj_new Object

An object containing the properties to update

Returns:

The tag ID that was updated

Type
Number

(static) updateTags(tags, obj_new) → {Array}

Update multiple tags at once

Example
utui.automator.updateTags([1,2,3], {title: "My renamed tags"});
Parameters:
Name Type Description
tags Array

An array of tag ID's to update

obj_new Object

An object containing the properties to update

Returns:

An array of tags that were updated

Type
Array

(static) updateVariable(title, obj)

Update a data source

Example
utui.automator.updateVariable("my_var", {
  "name" : "the_var"
});
Parameters:
Name Type Description
title String | Number

The title or ID of the data source

obj Object

Data source configuration object