This document describes the purpose and representation of the Tag Manager parameter object.
Introduction
The Tag Manager API allows you to create and manage Tag Manager resources such as Tags, Triggers, and Variables.
Most Tag and Variable types have additional parameters that are specific
to the Tag or Variable and can be set when creating/updating the resource. The list
of parameters (key
, type
pairs) for each Tag and Variable
type are listed in
the Tag Dictionary
Reference.
To configure these Tag or Variable specific parameters, a parameter
object is defined and set as the value for the parameter
property of the Tag
or
Variable resource.
The parameter object
The following object represents a parameter object:
[ { "type": string, "key": string, "value": string, "list": [ (Parameter) ], "map": [ (Parameter) ] } ]
type
The parameter type of the Tag or Variable being configured.
The type
property will determine
whether a value
, list
, or map
property
needs to be included in the parameter object, as described in the table
below.
For example, if type
is set to boolean
then a
value
property should be included in the parameter object and set
to true
or false
.
Value | Additional property to include | What to set additional property to |
---|---|---|
template |
value |
value is any string, including variable references, e.g.
foo{{bar}} . |
boolean |
value |
value is either true or false .
|
number |
value |
value is an integer. |
list |
list |
list will contain zero or more parameters, order may/may
not matter; the key of any parameter in the list
will be ignored. |
map |
map |
map will contain zero or more parameters, order doesn’t
matter; the key on any parameter in the map should
be unique. |
key
The parameter key of the Tag or Variable being configured.
The key
field is used to identify the parameter of specific
Tags or Variables that are being set. All parameter types need a key
property (except list
parameters).
Examples
A parameter object for a Custom HTML Tag,
which has one template
type parameter and two boolean
type
parameters:
"parameter": [ { "key": "html", "type": "template", "value": "<script>alert('hello world')</script>" }, { "key": "supportDocumentWrite", "type": "boolean", "value": "false" } ]
A parameter object for a Function Call
Tag, which has one template
type parameter and one map
type parameter:
"parameter": [ { "key": "functionName", "type": "template", "value": "fn" }, { "key": "functionArgument", "map": [ { "key": "argkey1", "type": "template", "value": "argval1" } ], "type": "map" } ]