The rules of a container. Rules evaluate to true or false during runtime. They can be used to control when a tag fires or is blocked from firing, and to control when macros in a mobile container are enabled or disabled. For more details, see the firing and disabling rules of a tag's configuration and the enabling and disabling rules of a macro's configuration, respectively.

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

Resource representations

Represents a Google Tag Manager rule.

  "accountId": string,
  "containerId": string,
  "ruleId": string,
  "name": string,
  "notes": string,
  "condition": [
      "type": string,
      "parameter": [
          "type": string,
          "key": string,
          "value": string,
          "list": [
          "map": [
  "fingerprint": string
Property name Value Description Notes
accountId string GTM Account ID.
condition[] list The list of conditions that make up this rule (implicit AND between them). writable
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 macro.
  • 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 and set it to true.
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
condition[].parameter[].list[] list This list parameter's parameters (keys will be ignored). writable
condition[].parameter[].map[] list This map parameter's parameters (must have keys; keys must be unique). writable
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 macro references (even macro references that might return non-string types)

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

Acceptable values are:
  • "contains"
  • "cssSelector"
  • "endsWith"
  • "equals"
  • "greater"
  • "greaterOrEquals"
  • "less"
  • "lessOrEquals"
  • "matchRegex"
  • "startsWith"
  • "urlMatches"
containerId string GTM Container ID.
fingerprint string The fingerprint of the GTM Rule as computed at storage time. This value is recomputed whenever the rule is modified.
name string Rule display name. writable
notes string User notes on how to apply this rule in the container. writable
ruleId string The Rule ID uniquely identifies the GTM Rule.


Use the methods below to create, modify, delete or retrieve rules.

Creates a GTM rule.
Deletes a GTM rule.
Gets a GTM rule.
Lists all GTM rules of a container.
Updates a GTM rule.