Skip to content

ZarazConfig

Source: src/Cloudflare/Zaraz/ZarazConfig.ts

A Cloudflare Zaraz zone configuration.

Cloudflare Zaraz is an edge-managed third-party tool manager and analytics event pipeline. See the {@link https://developers.cloudflare.com/zaraz/ | Cloudflare Zaraz docs} and {@link https://developers.cloudflare.com/zaraz/web-api/ | Web API docs}.

Zaraz is a zone-level singleton. This resource reconciles the current zone config and workflow to the desired values while retaining existing settings for fields omitted from props.

Destroy keeps the current Zaraz config by default to avoid wiping unrelated zone-level analytics setup. Set delete: true to restore Cloudflare’s default Zaraz config on destroy.

Enable data layer compatibility

const zaraz = yield* Cloudflare.ZarazConfig("Analytics", {
zone: "example.com",
dataLayer: true,
});

Update Zaraz settings

const zaraz = yield* Cloudflare.ZarazConfig("Analytics", {
zone: "example.com",
settings: {
autoInjectScript: true,
hideIPAddress: true,
},
});

Enable preview workflow

const zaraz = yield* Cloudflare.ZarazConfig("Analytics", {
zone: "example.com",
workflow: "preview",
});