Skip to content
Start here

Get Zaraz configuration

zaraz.config.get(ConfigGetParams**kwargs) -> Configuration
GET/zones/{zone_id}/settings/zaraz/config

Gets latest Zaraz configuration for a zone. It can be preview or published configuration, whichever was the last updated. Secret variables values will not be included.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zaraz EditZaraz ReadZaraz Admin
ParametersExpand Collapse
zone_id: str

Identifier.

maxLength32
ReturnsExpand Collapse
class Configuration:

Zaraz configuration.

data_layer: bool

Data layer compatibility mode enabled.

debug_key: str

The key for Zaraz debug mode.

settings: Settings

General Zaraz settings.

auto_inject_script: bool

Automatic injection of Zaraz scripts enabled.

context_enricher: Optional[SettingsContextEnricher]

Details of the worker that receives and edits Zaraz Context object.

escaped_worker_name: str
worker_tag: str
cookie_domain: Optional[str]

The domain Zaraz will use for writing and reading its cookies.

ecommerce: Optional[bool]

Ecommerce API enabled.

events_api_path: Optional[str]

Custom endpoint for server-side track events.

hide_external_referer: Optional[bool]

Hiding external referrer URL enabled.

hide_ip_address: Optional[bool]

Trimming IP address enabled.

hide_query_params: Optional[bool]

Removing URL query params enabled.

hide_user_agent: Optional[bool]

Removing sensitive data from User Agent string enabled.

init_path: Optional[str]

Custom endpoint for Zaraz init script.

inject_iframes: Optional[bool]

Injection of Zaraz scripts into iframes enabled.

mc_root_path: Optional[str]

Custom path for Managed Components server functionalities.

script_path: Optional[str]

Custom endpoint for Zaraz main script.

track_path: Optional[str]

Custom endpoint for Zaraz tracking requests.

tools: Dict[str, Tools]

Tools set up under Zaraz configuration, where key is the alpha-numeric tool ID and value is the tool configuration object.

One of the following:
class ToolsZarazManagedComponent:
blocking_triggers: List[str]

List of blocking trigger IDs.

component: str

Tool's internal name.

default_fields: Dict[str, Union[str, bool]]

Default fields for tool's actions.

One of the following:
str
bool
enabled: bool

Whether tool is enabled.

name: str

Tool's name defined by the user.

permissions: List[str]

List of permissions granted to the component.

settings: Dict[str, Union[str, bool]]

Tool's settings.

One of the following:
str
bool
type: Literal["component"]
actions: Optional[Dict[str, NeoEvent]]

Actions configured on a tool. Either this or neoEvents field is required.

action_type: str

Tool event type.

blocking_triggers: List[str]

List of blocking triggers IDs.

data: object

Event payload.

firing_triggers: List[str]

List of firing triggers IDs.

default_purpose: Optional[str]

Default consent purpose ID.

neo_events: Optional[List[NeoEvent]]

DEPRECATED - List of actions configured on a tool. Either this or actions field is required. If both are present, actions field will take precedence.

action_type: str

Tool event type.

blocking_triggers: List[str]

List of blocking triggers IDs.

data: object

Event payload.

firing_triggers: List[str]

List of firing triggers IDs.

vendor_name: Optional[str]

Vendor name for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned.

vendor_policy_url: Optional[str]

Vendor's Privacy Policy URL for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned.

class ToolsWorker:
blocking_triggers: List[str]

List of blocking trigger IDs.

component: str

Tool's internal name.

default_fields: Dict[str, Union[str, bool]]

Default fields for tool's actions.

One of the following:
str
bool
enabled: bool

Whether tool is enabled.

name: str

Tool's name defined by the user.

permissions: List[str]

List of permissions granted to the component.

settings: Dict[str, Union[str, bool]]

Tool's settings.

One of the following:
str
bool
type: Literal["custom-mc"]
worker: ToolsWorkerWorker

Cloudflare worker that acts as a managed component.

escaped_worker_name: str
worker_tag: str
actions: Optional[Dict[str, NeoEvent]]

Actions configured on a tool. Either this or neoEvents field is required.

action_type: str

Tool event type.

blocking_triggers: List[str]

List of blocking triggers IDs.

data: object

Event payload.

firing_triggers: List[str]

List of firing triggers IDs.

default_purpose: Optional[str]

Default consent purpose ID.

neo_events: Optional[List[NeoEvent]]

DEPRECATED - List of actions configured on a tool. Either this or actions field is required. If both are present, actions field will take precedence.

action_type: str

Tool event type.

blocking_triggers: List[str]

List of blocking triggers IDs.

data: object

Event payload.

firing_triggers: List[str]

List of firing triggers IDs.

vendor_name: Optional[str]

Vendor name for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned.

vendor_policy_url: Optional[str]

Vendor's Privacy Policy URL for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned.

triggers: Dict[str, Triggers]

Triggers set up under Zaraz configuration, where key is the trigger alpha-numeric ID and value is the trigger configuration.

exclude_rules: List[TriggersExcludeRule]

Rules defining when the trigger is not fired.

One of the following:
class TriggersExcludeRuleZarazLoadRule:
id: str
match: str
op: Literal["CONTAINS", "EQUALS", "STARTS_WITH", 7 more]
One of the following:
"CONTAINS"
"EQUALS"
"STARTS_WITH"
"ENDS_WITH"
"MATCH_REGEX"
"NOT_MATCH_REGEX"
"GREATER_THAN"
"GREATER_THAN_OR_EQUAL"
"LESS_THAN"
"LESS_THAN_OR_EQUAL"
value: str
class TriggersExcludeRuleZarazClickListenerRule:
id: str
action: Literal["clickListener"]
settings: TriggersExcludeRuleZarazClickListenerRuleSettings
selector: str
type: Literal["xpath", "css"]
One of the following:
"xpath"
"css"
wait_for_tags: int
minimum0
class TriggersExcludeRuleZarazTimerRule:
id: str
action: Literal["timer"]
settings: TriggersExcludeRuleZarazTimerRuleSettings
interval: int
minimum50
limit: int
minimum0
class TriggersExcludeRuleZarazFormSubmissionRule:
id: str
action: Literal["formSubmission"]
settings: TriggersExcludeRuleZarazFormSubmissionRuleSettings
selector: str
validate: bool
class TriggersExcludeRuleZarazVariableMatchRule:
id: str
action: Literal["variableMatch"]
settings: TriggersExcludeRuleZarazVariableMatchRuleSettings
match: str
variable: str
class TriggersExcludeRuleZarazScrollDepthRule:
id: str
action: Literal["scrollDepth"]
settings: TriggersExcludeRuleZarazScrollDepthRuleSettings
positions: str
class TriggersExcludeRuleZarazElementVisibilityRule:
id: str
action: Literal["elementVisibility"]
settings: TriggersExcludeRuleZarazElementVisibilityRuleSettings
selector: str
load_rules: List[TriggersLoadRule]

Rules defining when the trigger is fired.

One of the following:
class TriggersLoadRuleZarazLoadRule:
id: str
match: str
op: Literal["CONTAINS", "EQUALS", "STARTS_WITH", 7 more]
One of the following:
"CONTAINS"
"EQUALS"
"STARTS_WITH"
"ENDS_WITH"
"MATCH_REGEX"
"NOT_MATCH_REGEX"
"GREATER_THAN"
"GREATER_THAN_OR_EQUAL"
"LESS_THAN"
"LESS_THAN_OR_EQUAL"
value: str
class TriggersLoadRuleZarazClickListenerRule:
id: str
action: Literal["clickListener"]
settings: TriggersLoadRuleZarazClickListenerRuleSettings
selector: str
type: Literal["xpath", "css"]
One of the following:
"xpath"
"css"
wait_for_tags: int
minimum0
class TriggersLoadRuleZarazTimerRule:
id: str
action: Literal["timer"]
settings: TriggersLoadRuleZarazTimerRuleSettings
interval: int
minimum50
limit: int
minimum0
class TriggersLoadRuleZarazFormSubmissionRule:
id: str
action: Literal["formSubmission"]
settings: TriggersLoadRuleZarazFormSubmissionRuleSettings
selector: str
validate: bool
class TriggersLoadRuleZarazVariableMatchRule:
id: str
action: Literal["variableMatch"]
settings: TriggersLoadRuleZarazVariableMatchRuleSettings
match: str
variable: str
class TriggersLoadRuleZarazScrollDepthRule:
id: str
action: Literal["scrollDepth"]
settings: TriggersLoadRuleZarazScrollDepthRuleSettings
positions: str
class TriggersLoadRuleZarazElementVisibilityRule:
id: str
action: Literal["elementVisibility"]
settings: TriggersLoadRuleZarazElementVisibilityRuleSettings
selector: str
name: str

Trigger name.

description: Optional[str]

Trigger description.

system: Optional[Literal["pageload"]]
variables: Dict[str, Variables]

Variables set up under Zaraz configuration, where key is the variable alpha-numeric ID and value is the variable configuration. Values of variables of type secret are not included.

One of the following:
class VariablesZarazStringVariable:
name: str
type: Literal["string"]
value: str
class VariablesZarazSecretVariable:
name: str
type: Literal["secret"]
value: str
class VariablesZarazWorkerVariable:
name: str
type: Literal["worker"]
value: VariablesZarazWorkerVariableValue
escaped_worker_name: str
worker_tag: str
zaraz_version: int

Zaraz internal version of the config.

analytics: Optional[Analytics]

Cloudflare Monitoring settings.

default_purpose: Optional[str]

Consent purpose assigned to Monitoring.

enabled: Optional[bool]

Whether Advanced Monitoring reports are enabled.

session_exp_time: Optional[int]

Session expiration time (seconds).

maximum86400
minimum60
history_change: Optional[bool]

Single Page Application support enabled.

Get Zaraz configuration

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
configuration = client.zaraz.config.get(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(configuration.data_layer)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "dataLayer": true,
    "debugKey": "debugKey",
    "settings": {
      "autoInjectScript": true,
      "contextEnricher": {
        "escapedWorkerName": "escapedWorkerName",
        "workerTag": "workerTag"
      },
      "cookieDomain": "cookieDomain",
      "ecommerce": true,
      "eventsApiPath": "eventsApiPath",
      "hideExternalReferer": true,
      "hideIPAddress": true,
      "hideQueryParams": true,
      "hideUserAgent": true,
      "initPath": "initPath",
      "injectIframes": true,
      "mcRootPath": "mcRootPath",
      "scriptPath": "scriptPath",
      "trackPath": "trackPath"
    },
    "tools": {
      "foo": {
        "blockingTriggers": [
          "string"
        ],
        "component": "component",
        "defaultFields": {
          "foo": "string"
        },
        "enabled": true,
        "name": "name",
        "permissions": [
          "string"
        ],
        "settings": {
          "foo": "string"
        },
        "type": "component",
        "actions": {
          "foo": {
            "actionType": "actionType",
            "blockingTriggers": [
              "string"
            ],
            "data": {},
            "firingTriggers": [
              "string"
            ]
          }
        },
        "defaultPurpose": "defaultPurpose",
        "neoEvents": [
          {
            "actionType": "actionType",
            "blockingTriggers": [
              "string"
            ],
            "data": {},
            "firingTriggers": [
              "string"
            ]
          }
        ],
        "vendorName": "vendorName",
        "vendorPolicyUrl": "vendorPolicyUrl"
      }
    },
    "triggers": {
      "foo": {
        "excludeRules": [
          {
            "id": "id",
            "match": "match",
            "op": "CONTAINS",
            "value": "value"
          }
        ],
        "loadRules": [
          {
            "id": "id",
            "match": "match",
            "op": "CONTAINS",
            "value": "value"
          }
        ],
        "name": "name",
        "description": "description",
        "system": "pageload"
      }
    },
    "variables": {
      "foo": {
        "name": "name",
        "type": "string",
        "value": "value"
      }
    },
    "zarazVersion": 0,
    "analytics": {
      "defaultPurpose": "defaultPurpose",
      "enabled": true,
      "sessionExpTime": 60
    },
    "consent": {
      "enabled": true,
      "buttonTextTranslations": {
        "accept_all": {
          "foo": "string"
        },
        "confirm_my_choices": {
          "foo": "string"
        },
        "reject_all": {
          "foo": "string"
        }
      },
      "companyEmail": "companyEmail",
      "companyName": "companyName",
      "companyStreetAddress": "companyStreetAddress",
      "consentModalIntroHTML": "consentModalIntroHTML",
      "consentModalIntroHTMLWithTranslations": {
        "foo": "string"
      },
      "cookieName": "cookieName",
      "customCSS": "customCSS",
      "customIntroDisclaimerDismissed": true,
      "defaultLanguage": "defaultLanguage",
      "hideModal": true,
      "purposes": {
        "foo": {
          "description": "description",
          "name": "name"
        }
      },
      "purposesWithTranslations": {
        "foo": {
          "description": {
            "foo": "string"
          },
          "name": {
            "foo": "string"
          },
          "order": 0
        }
      },
      "tcfCompliant": true
    },
    "historyChange": true
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "dataLayer": true,
    "debugKey": "debugKey",
    "settings": {
      "autoInjectScript": true,
      "contextEnricher": {
        "escapedWorkerName": "escapedWorkerName",
        "workerTag": "workerTag"
      },
      "cookieDomain": "cookieDomain",
      "ecommerce": true,
      "eventsApiPath": "eventsApiPath",
      "hideExternalReferer": true,
      "hideIPAddress": true,
      "hideQueryParams": true,
      "hideUserAgent": true,
      "initPath": "initPath",
      "injectIframes": true,
      "mcRootPath": "mcRootPath",
      "scriptPath": "scriptPath",
      "trackPath": "trackPath"
    },
    "tools": {
      "foo": {
        "blockingTriggers": [
          "string"
        ],
        "component": "component",
        "defaultFields": {
          "foo": "string"
        },
        "enabled": true,
        "name": "name",
        "permissions": [
          "string"
        ],
        "settings": {
          "foo": "string"
        },
        "type": "component",
        "actions": {
          "foo": {
            "actionType": "actionType",
            "blockingTriggers": [
              "string"
            ],
            "data": {},
            "firingTriggers": [
              "string"
            ]
          }
        },
        "defaultPurpose": "defaultPurpose",
        "neoEvents": [
          {
            "actionType": "actionType",
            "blockingTriggers": [
              "string"
            ],
            "data": {},
            "firingTriggers": [
              "string"
            ]
          }
        ],
        "vendorName": "vendorName",
        "vendorPolicyUrl": "vendorPolicyUrl"
      }
    },
    "triggers": {
      "foo": {
        "excludeRules": [
          {
            "id": "id",
            "match": "match",
            "op": "CONTAINS",
            "value": "value"
          }
        ],
        "loadRules": [
          {
            "id": "id",
            "match": "match",
            "op": "CONTAINS",
            "value": "value"
          }
        ],
        "name": "name",
        "description": "description",
        "system": "pageload"
      }
    },
    "variables": {
      "foo": {
        "name": "name",
        "type": "string",
        "value": "value"
      }
    },
    "zarazVersion": 0,
    "analytics": {
      "defaultPurpose": "defaultPurpose",
      "enabled": true,
      "sessionExpTime": 60
    },
    "consent": {
      "enabled": true,
      "buttonTextTranslations": {
        "accept_all": {
          "foo": "string"
        },
        "confirm_my_choices": {
          "foo": "string"
        },
        "reject_all": {
          "foo": "string"
        }
      },
      "companyEmail": "companyEmail",
      "companyName": "companyName",
      "companyStreetAddress": "companyStreetAddress",
      "consentModalIntroHTML": "consentModalIntroHTML",
      "consentModalIntroHTMLWithTranslations": {
        "foo": "string"
      },
      "cookieName": "cookieName",
      "customCSS": "customCSS",
      "customIntroDisclaimerDismissed": true,
      "defaultLanguage": "defaultLanguage",
      "hideModal": true,
      "purposes": {
        "foo": {
          "description": "description",
          "name": "name"
        }
      },
      "purposesWithTranslations": {
        "foo": {
          "description": {
            "foo": "string"
          },
          "name": {
            "foo": "string"
          },
          "order": 0
        }
      },
      "tcfCompliant": true
    },
    "historyChange": true
  },
  "success": true
}