Container Versions

The Container Versions of a container. A container version can be thought of as an immutable copy (snapshot) of a container's configuration at a particular point in time. Creating a new version using the create method will create a version based on the current configuration (i.e. the container's macros, rules and tags). The restore method will restore the container's configuration using the specified version. The update method allows updating a version's name and notes fields. To fetch the currently published version, use the get method and specify published for the containerVersionId.

For a list of methods for this resource, see the end of this page.

Resource representations

Represents a Google Tag Manager container version.

{
  "accountId": string,
  "containerId": string,
  "containerVersionId": string,
  "name": string,
  "deleted": boolean,
  "notes": string,
  "container": accounts.containers Resource,
  "macro": [
    {
      "accountId": string,
      "containerId": string,
      "macroId": string,
      "name": string,
      "type": string,
      "notes": string,
      "scheduleStartMs": long,
      "scheduleEndMs": long,
      "parameter": [
        {
          "type": string,
          "key": string,
          "value": string,
          "list": [
            (Parameter)
          ],
          "map": [
            (Parameter)
          ]
        }
      ],
      "enablingRuleId": [
        string
      ],
      "disablingRuleId": [
        string
      ],
      "fingerprint": string,
      "parentFolderId": string
    }
  ],
  "rule": [
    {
      "accountId": string,
      "containerId": string,
      "ruleId": string,
      "name": string,
      "notes": string,
      "condition": [
        {
          "type": string,
          "parameter": [
            {
              "type": string,
              "key": string,
              "value": string,
              "list": [
                (Parameter)
              ],
              "map": [
                (Parameter)
              ]
            }
          ]
        }
      ],
      "fingerprint": string
    }
  ],
  "tag": [
    accounts.containers.tags Resource
  ],
  "trigger": [
    accounts.containers.triggers Resource
  ],
  "variable": [
    accounts.containers.variables Resource
  ],
  "folder": [
    accounts.containers.folders Resource
  ],
  "fingerprint": string
}
Property name Value Description Notes
accountId string GTM Account ID.
container nested object The container that this version was taken from.
containerId string GTM Container ID.
containerVersionId string The containerVersionId uniquely identifies the GTM Container Version.
deleted boolean A value of true indicates this container version has been deleted.
fingerprint string The fingerprint of the GTM container version as computed at storage time. This value is recomputed whenever the container version is modified.
folder[] list The folders in the container that this version was taken from.
macro[] list The macros in the container that this version was taken from.
macro[].accountId string GTM Account ID.
macro[].containerId string GTM Container ID.
macro[].disablingRuleId[] list For mobile containers only: A list of rule IDs for disabling conditional macros; the macro is enabled if one of the enabling rules is true while all the disabling rules are false. Treated as an unordered set.
macro[].enablingRuleId[] list For mobile containers only: A list of rule IDs for enabling conditional macros; the macro is enabled if one of the enabling rules is true while all the disabling rules are false. Treated as an unordered set.
macro[].fingerprint string The fingerprint of the GTM Macro as computed at storage time. This value is recomputed whenever the macro is modified.
macro[].macroId string The Macro ID uniquely identifies the GTM Macro.
macro[].name string Macro display name.
macro[].notes string User notes on how to apply this macro in the container.
macro[].parameter[] list The macro's parameters.
macro[].parameter[].key string The named key that uniquely identifies a parameter. Required for top-level parameters, as well as map values. Ignored for list values. writable
macro[].parameter[].list[] list This list parameter's parameters (keys will be ignored). writable
macro[].parameter[].map[] list This map parameter's parameters (must have keys; keys must be unique). writable
macro[].parameter[].type string The parameter type. Valid values are:
  • boolean: The value represents a boolean, represented as 'true' or 'false'
  • integer: The value represents a 64-bit signed integer value, in base 10
  • list: A list of parameters should be specified
  • map: A map of parameters should be specified
  • template: The value represents any text; this can include variable references (even variable references that might return non-string types)
  • trigger_reference: The value represents a trigger, represented as the trigger id


Acceptable values are:
  • "boolean"
  • "integer"
  • "list"
  • "map"
  • "template"
  • "triggerReference"
writable
macro[].parameter[].value string A parameter's value (may contain variable references such as "{{myVariable}}") as appropriate to the specified type. writable
macro[].parentFolderId string Parent folder id.
macro[].scheduleEndMs long The end timestamp in milliseconds to schedule a macro.
macro[].scheduleStartMs long The start timestamp in milliseconds to schedule a macro.
macro[].type string GTM Macro Type.
name string Container version display name. writable
notes string User notes on how to apply this container version in the container. writable
rule[] list The rules in the container that this version was taken from.
rule[].accountId string GTM Account ID.
rule[].condition[] list The list of conditions that make up this rule (implicit AND between them).
rule[].condition[].parameter[] list A list of named parameters (key/value), depending on the condition's type. Notes:
  • For binary operators, include parameters named arg0 and arg1 for specifying the left and right operands, respectively.
  • At this time, the left operand (arg0) must be a reference to a variable.
  • For case-insensitive Regex matching, include a boolean parameter named ignore_case that is set to true. If not specified or set to any other value, the matching will be case sensitive.
  • To negate an operator, include a boolean parameter named negate boolean parameter that is set to true.
writable
rule[].condition[].parameter[].key string The named key that uniquely identifies a parameter. Required for top-level parameters, as well as map values. Ignored for list values. writable
rule[].condition[].parameter[].list[] list This list parameter's parameters (keys will be ignored). writable
rule[].condition[].parameter[].map[] list This map parameter's parameters (must have keys; keys must be unique). writable
rule[].condition[].parameter[].type string The parameter type. Valid values are:
  • boolean: The value represents a boolean, represented as 'true' or 'false'
  • integer: The value represents a 64-bit signed integer value, in base 10
  • list: A list of parameters should be specified
  • map: A map of parameters should be specified
  • template: The value represents any text; this can include variable references (even variable references that might return non-string types)
  • trigger_reference: The value represents a trigger, represented as the trigger id


Acceptable values are:
  • "boolean"
  • "integer"
  • "list"
  • "map"
  • "template"
  • "triggerReference"
writable
rule[].condition[].parameter[].value string A parameter's value (may contain variable references such as "{{myVariable}}") as appropriate to the specified type. writable
rule[].condition[].type string The type of operator for this condition.

Acceptable values are:
  • "contains"
  • "cssSelector"
  • "endsWith"
  • "equals"
  • "greater"
  • "greaterOrEquals"
  • "less"
  • "lessOrEquals"
  • "matchRegex"
  • "startsWith"
  • "urlMatches"
writable
rule[].containerId string GTM Container ID.
rule[].fingerprint string The fingerprint of the GTM Rule as computed at storage time. This value is recomputed whenever the rule is modified.
rule[].name string Rule display name.
rule[].notes string User notes on how to apply this rule in the container.
rule[].ruleId string The Rule ID uniquely identifies the GTM Rule.
tag[] list The tags in the container that this version was taken from.
trigger[] list The triggers in the container that this version was taken from.
variable[] list The variables in the container that this version was taken from.

Methods

create
Creates a container version.
delete
Deletes a container version.
get
Gets a container version.
list
Lists all container versions of a GTM container.
publish
Publishes a container version.
restore
Restores a Container Version. This will overwrite the container's current configuration (including its variables, triggers and tags). The operation will not have any effect on the version that is being served (i.e. the published version).
undelete
Undeletes a container version.
update
Updates a container version.