## Get Zaraz configuration `client.Zaraz.Config.Get(ctx, query) (*Configuration, error)` **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. ### Parameters - `query ConfigGetParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type Configuration struct{…}` Zaraz configuration. - `DataLayer bool` Data layer compatibility mode enabled. - `DebugKey string` The key for Zaraz debug mode. - `Settings ConfigurationSettings` General Zaraz settings. - `AutoInjectScript bool` Automatic injection of Zaraz scripts enabled. - `ContextEnricher ConfigurationSettingsContextEnricher` Details of the worker that receives and edits Zaraz Context object. - `EscapedWorkerName string` - `WorkerTag string` - `CookieDomain string` The domain Zaraz will use for writing and reading its cookies. - `Ecommerce bool` Ecommerce API enabled. - `EventsAPIPath string` Custom endpoint for server-side track events. - `HideExternalReferer bool` Hiding external referrer URL enabled. - `HideIPAddress bool` Trimming IP address enabled. - `HideQueryParams bool` Removing URL query params enabled. - `HideUserAgent bool` Removing sensitive data from User Agent string enabled. - `InitPath string` Custom endpoint for Zaraz init script. - `InjectIframes bool` Injection of Zaraz scripts into iframes enabled. - `McRootPath string` Custom path for Managed Components server functionalities. - `ScriptPath string` Custom endpoint for Zaraz main script. - `TrackPath string` Custom endpoint for Zaraz tracking requests. - `Tools map[string, ConfigurationTool]` Tools set up under Zaraz configuration, where key is the alpha-numeric tool ID and value is the tool configuration object. - `type ConfigurationToolsZarazManagedComponent struct{…}` - `BlockingTriggers []string` List of blocking trigger IDs. - `Component string` Tool's internal name. - `DefaultFields map[string, ConfigurationToolsZarazManagedComponentDefaultFieldsUnion]` Default fields for tool's actions. - `UnionString` - `UnionBool` - `Enabled bool` Whether tool is enabled. - `Name string` Tool's name defined by the user. - `Permissions []string` List of permissions granted to the component. - `Settings map[string, ConfigurationToolsZarazManagedComponentSettingsUnion]` Tool's settings. - `UnionString` - `UnionBool` - `Type ConfigurationToolsZarazManagedComponentType` - `const ConfigurationToolsZarazManagedComponentTypeComponent ConfigurationToolsZarazManagedComponentType = "component"` - `Actions map[string, NeoEvent]` Actions configured on a tool. Either this or neoEvents field is required. - `ActionType string` Tool event type. - `BlockingTriggers []string` List of blocking triggers IDs. - `Data unknown` Event payload. - `FiringTriggers []string` List of firing triggers IDs. - `DefaultPurpose string` Default consent purpose ID. - `NeoEvents []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. - `ActionType string` Tool event type. - `BlockingTriggers []string` List of blocking triggers IDs. - `Data unknown` Event payload. - `FiringTriggers []string` List of firing triggers IDs. - `VendorName string` Vendor name for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned. - `VendorPolicyURL string` Vendor's Privacy Policy URL for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned. - `type ConfigurationToolsWorker struct{…}` - `BlockingTriggers []string` List of blocking trigger IDs. - `Component string` Tool's internal name. - `DefaultFields map[string, ConfigurationToolsWorkerDefaultFieldsUnion]` Default fields for tool's actions. - `UnionString` - `UnionBool` - `Enabled bool` Whether tool is enabled. - `Name string` Tool's name defined by the user. - `Permissions []string` List of permissions granted to the component. - `Settings map[string, ConfigurationToolsWorkerSettingsUnion]` Tool's settings. - `UnionString` - `UnionBool` - `Type ConfigurationToolsWorkerType` - `const ConfigurationToolsWorkerTypeCustomMc ConfigurationToolsWorkerType = "custom-mc"` - `Worker ConfigurationToolsWorkerWorker` Cloudflare worker that acts as a managed component. - `EscapedWorkerName string` - `WorkerTag string` - `Actions map[string, NeoEvent]` Actions configured on a tool. Either this or neoEvents field is required. - `ActionType string` Tool event type. - `BlockingTriggers []string` List of blocking triggers IDs. - `Data unknown` Event payload. - `FiringTriggers []string` List of firing triggers IDs. - `DefaultPurpose string` Default consent purpose ID. - `NeoEvents []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. - `ActionType string` Tool event type. - `BlockingTriggers []string` List of blocking triggers IDs. - `Data unknown` Event payload. - `FiringTriggers []string` List of firing triggers IDs. - `VendorName string` Vendor name for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned. - `VendorPolicyURL string` Vendor's Privacy Policy URL for TCF compliant consent modal, required for Custom Managed Components and Custom HTML tool with a defaultPurpose assigned. - `Triggers map[string, ConfigurationTrigger]` Triggers set up under Zaraz configuration, where key is the trigger alpha-numeric ID and value is the trigger configuration. - `ExcludeRules []ConfigurationTriggersExcludeRule` Rules defining when the trigger is not fired. - `type ConfigurationTriggersExcludeRulesZarazLoadRule struct{…}` - `ID string` - `Match string` - `Op ConfigurationTriggersExcludeRulesZarazLoadRuleOp` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpContains ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "CONTAINS"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpEquals ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "EQUALS"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpStartsWith ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "STARTS_WITH"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpEndsWith ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "ENDS_WITH"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpMatchRegex ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "MATCH_REGEX"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpNotMatchRegex ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "NOT_MATCH_REGEX"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpGreaterThan ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "GREATER_THAN"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpGreaterThanOrEqual ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "GREATER_THAN_OR_EQUAL"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpLessThan ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "LESS_THAN"` - `const ConfigurationTriggersExcludeRulesZarazLoadRuleOpLessThanOrEqual ConfigurationTriggersExcludeRulesZarazLoadRuleOp = "LESS_THAN_OR_EQUAL"` - `Value string` - `type ConfigurationTriggersExcludeRulesZarazClickListenerRule struct{…}` - `ID string` - `Action ConfigurationTriggersExcludeRulesZarazClickListenerRuleAction` - `const ConfigurationTriggersExcludeRulesZarazClickListenerRuleActionClickListener ConfigurationTriggersExcludeRulesZarazClickListenerRuleAction = "clickListener"` - `Settings ConfigurationTriggersExcludeRulesZarazClickListenerRuleSettings` - `Selector string` - `Type ConfigurationTriggersExcludeRulesZarazClickListenerRuleSettingsType` - `const ConfigurationTriggersExcludeRulesZarazClickListenerRuleSettingsTypeXpath ConfigurationTriggersExcludeRulesZarazClickListenerRuleSettingsType = "xpath"` - `const ConfigurationTriggersExcludeRulesZarazClickListenerRuleSettingsTypeCSS ConfigurationTriggersExcludeRulesZarazClickListenerRuleSettingsType = "css"` - `WaitForTags int64` - `type ConfigurationTriggersExcludeRulesZarazTimerRule struct{…}` - `ID string` - `Action ConfigurationTriggersExcludeRulesZarazTimerRuleAction` - `const ConfigurationTriggersExcludeRulesZarazTimerRuleActionTimer ConfigurationTriggersExcludeRulesZarazTimerRuleAction = "timer"` - `Settings ConfigurationTriggersExcludeRulesZarazTimerRuleSettings` - `Interval int64` - `Limit int64` - `type ConfigurationTriggersExcludeRulesZarazFormSubmissionRule struct{…}` - `ID string` - `Action ConfigurationTriggersExcludeRulesZarazFormSubmissionRuleAction` - `const ConfigurationTriggersExcludeRulesZarazFormSubmissionRuleActionFormSubmission ConfigurationTriggersExcludeRulesZarazFormSubmissionRuleAction = "formSubmission"` - `Settings ConfigurationTriggersExcludeRulesZarazFormSubmissionRuleSettings` - `Selector string` - `Validate bool` - `type ConfigurationTriggersExcludeRulesZarazVariableMatchRule struct{…}` - `ID string` - `Action ConfigurationTriggersExcludeRulesZarazVariableMatchRuleAction` - `const ConfigurationTriggersExcludeRulesZarazVariableMatchRuleActionVariableMatch ConfigurationTriggersExcludeRulesZarazVariableMatchRuleAction = "variableMatch"` - `Settings ConfigurationTriggersExcludeRulesZarazVariableMatchRuleSettings` - `Match string` - `Variable string` - `type ConfigurationTriggersExcludeRulesZarazScrollDepthRule struct{…}` - `ID string` - `Action ConfigurationTriggersExcludeRulesZarazScrollDepthRuleAction` - `const ConfigurationTriggersExcludeRulesZarazScrollDepthRuleActionScrollDepth ConfigurationTriggersExcludeRulesZarazScrollDepthRuleAction = "scrollDepth"` - `Settings ConfigurationTriggersExcludeRulesZarazScrollDepthRuleSettings` - `Positions string` - `type ConfigurationTriggersExcludeRulesZarazElementVisibilityRule struct{…}` - `ID string` - `Action ConfigurationTriggersExcludeRulesZarazElementVisibilityRuleAction` - `const ConfigurationTriggersExcludeRulesZarazElementVisibilityRuleActionElementVisibility ConfigurationTriggersExcludeRulesZarazElementVisibilityRuleAction = "elementVisibility"` - `Settings ConfigurationTriggersExcludeRulesZarazElementVisibilityRuleSettings` - `Selector string` - `LoadRules []ConfigurationTriggersLoadRule` Rules defining when the trigger is fired. - `type ConfigurationTriggersLoadRulesZarazLoadRule struct{…}` - `ID string` - `Match string` - `Op ConfigurationTriggersLoadRulesZarazLoadRuleOp` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpContains ConfigurationTriggersLoadRulesZarazLoadRuleOp = "CONTAINS"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpEquals ConfigurationTriggersLoadRulesZarazLoadRuleOp = "EQUALS"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpStartsWith ConfigurationTriggersLoadRulesZarazLoadRuleOp = "STARTS_WITH"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpEndsWith ConfigurationTriggersLoadRulesZarazLoadRuleOp = "ENDS_WITH"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpMatchRegex ConfigurationTriggersLoadRulesZarazLoadRuleOp = "MATCH_REGEX"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpNotMatchRegex ConfigurationTriggersLoadRulesZarazLoadRuleOp = "NOT_MATCH_REGEX"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpGreaterThan ConfigurationTriggersLoadRulesZarazLoadRuleOp = "GREATER_THAN"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpGreaterThanOrEqual ConfigurationTriggersLoadRulesZarazLoadRuleOp = "GREATER_THAN_OR_EQUAL"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpLessThan ConfigurationTriggersLoadRulesZarazLoadRuleOp = "LESS_THAN"` - `const ConfigurationTriggersLoadRulesZarazLoadRuleOpLessThanOrEqual ConfigurationTriggersLoadRulesZarazLoadRuleOp = "LESS_THAN_OR_EQUAL"` - `Value string` - `type ConfigurationTriggersLoadRulesZarazClickListenerRule struct{…}` - `ID string` - `Action ConfigurationTriggersLoadRulesZarazClickListenerRuleAction` - `const ConfigurationTriggersLoadRulesZarazClickListenerRuleActionClickListener ConfigurationTriggersLoadRulesZarazClickListenerRuleAction = "clickListener"` - `Settings ConfigurationTriggersLoadRulesZarazClickListenerRuleSettings` - `Selector string` - `Type ConfigurationTriggersLoadRulesZarazClickListenerRuleSettingsType` - `const ConfigurationTriggersLoadRulesZarazClickListenerRuleSettingsTypeXpath ConfigurationTriggersLoadRulesZarazClickListenerRuleSettingsType = "xpath"` - `const ConfigurationTriggersLoadRulesZarazClickListenerRuleSettingsTypeCSS ConfigurationTriggersLoadRulesZarazClickListenerRuleSettingsType = "css"` - `WaitForTags int64` - `type ConfigurationTriggersLoadRulesZarazTimerRule struct{…}` - `ID string` - `Action ConfigurationTriggersLoadRulesZarazTimerRuleAction` - `const ConfigurationTriggersLoadRulesZarazTimerRuleActionTimer ConfigurationTriggersLoadRulesZarazTimerRuleAction = "timer"` - `Settings ConfigurationTriggersLoadRulesZarazTimerRuleSettings` - `Interval int64` - `Limit int64` - `type ConfigurationTriggersLoadRulesZarazFormSubmissionRule struct{…}` - `ID string` - `Action ConfigurationTriggersLoadRulesZarazFormSubmissionRuleAction` - `const ConfigurationTriggersLoadRulesZarazFormSubmissionRuleActionFormSubmission ConfigurationTriggersLoadRulesZarazFormSubmissionRuleAction = "formSubmission"` - `Settings ConfigurationTriggersLoadRulesZarazFormSubmissionRuleSettings` - `Selector string` - `Validate bool` - `type ConfigurationTriggersLoadRulesZarazVariableMatchRule struct{…}` - `ID string` - `Action ConfigurationTriggersLoadRulesZarazVariableMatchRuleAction` - `const ConfigurationTriggersLoadRulesZarazVariableMatchRuleActionVariableMatch ConfigurationTriggersLoadRulesZarazVariableMatchRuleAction = "variableMatch"` - `Settings ConfigurationTriggersLoadRulesZarazVariableMatchRuleSettings` - `Match string` - `Variable string` - `type ConfigurationTriggersLoadRulesZarazScrollDepthRule struct{…}` - `ID string` - `Action ConfigurationTriggersLoadRulesZarazScrollDepthRuleAction` - `const ConfigurationTriggersLoadRulesZarazScrollDepthRuleActionScrollDepth ConfigurationTriggersLoadRulesZarazScrollDepthRuleAction = "scrollDepth"` - `Settings ConfigurationTriggersLoadRulesZarazScrollDepthRuleSettings` - `Positions string` - `type ConfigurationTriggersLoadRulesZarazElementVisibilityRule struct{…}` - `ID string` - `Action ConfigurationTriggersLoadRulesZarazElementVisibilityRuleAction` - `const ConfigurationTriggersLoadRulesZarazElementVisibilityRuleActionElementVisibility ConfigurationTriggersLoadRulesZarazElementVisibilityRuleAction = "elementVisibility"` - `Settings ConfigurationTriggersLoadRulesZarazElementVisibilityRuleSettings` - `Selector string` - `Name string` Trigger name. - `Description string` Trigger description. - `System ConfigurationTriggersSystem` - `const ConfigurationTriggersSystemPageload ConfigurationTriggersSystem = "pageload"` - `Variables map[string, ConfigurationVariable]` 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. - `type ConfigurationVariablesZarazStringVariable struct{…}` - `Name string` - `Type ConfigurationVariablesZarazStringVariableType` - `const ConfigurationVariablesZarazStringVariableTypeString ConfigurationVariablesZarazStringVariableType = "string"` - `Value string` - `type ConfigurationVariablesZarazSecretVariable struct{…}` - `Name string` - `Type ConfigurationVariablesZarazSecretVariableType` - `const ConfigurationVariablesZarazSecretVariableTypeSecret ConfigurationVariablesZarazSecretVariableType = "secret"` - `Value string` - `type ConfigurationVariablesZarazWorkerVariable struct{…}` - `Name string` - `Type ConfigurationVariablesZarazWorkerVariableType` - `const ConfigurationVariablesZarazWorkerVariableTypeWorker ConfigurationVariablesZarazWorkerVariableType = "worker"` - `Value ConfigurationVariablesZarazWorkerVariableValue` - `EscapedWorkerName string` - `WorkerTag string` - `ZarazVersion int64` Zaraz internal version of the config. - `Analytics ConfigurationAnalytics` Cloudflare Monitoring settings. - `DefaultPurpose string` Consent purpose assigned to Monitoring. - `Enabled bool` Whether Advanced Monitoring reports are enabled. - `SessionExpTime int64` Session expiration time (seconds). - `Consent ConfigurationConsent` Consent management configuration. - `Enabled bool` - `ButtonTextTranslations ButtonTextTranslation` - `AcceptAll map[string, string]` Object where keys are language codes. - `ConfirmMyChoices map[string, string]` Object where keys are language codes. - `RejectAll map[string, string]` Object where keys are language codes. - `CompanyEmail string` - `CompanyName string` - `CompanyStreetAddress string` - `ConsentModalIntroHTML string` - `ConsentModalIntroHTMLWithTranslations map[string, string]` Object where keys are language codes. - `CookieName string` - `CustomCSS string` - `CustomIntroDisclaimerDismissed bool` - `DefaultLanguage string` - `HideModal bool` - `Purposes map[string, ConfigurationConsentPurpose]` Object where keys are purpose alpha-numeric IDs. - `Description string` - `Name string` - `PurposesWithTranslations map[string, ConfigurationConsentPurposesWithTranslation]` Object where keys are purpose alpha-numeric IDs. - `Description map[string, string]` Object where keys are language codes. - `Name map[string, string]` Object where keys are language codes. - `Order int64` - `TcfCompliant bool` - `HistoryChange bool` Single Page Application support enabled. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zaraz" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) configuration, err := client.Zaraz.Config.Get(context.TODO(), zaraz.ConfigGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", configuration.DataLayer) } ``` #### Response ```json { "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 } ```