Zaraz
Zaraz: third-party tool loading, configured per zone and served from the edge.
Get Config
Get the latest Zaraz configuration for a zone.
Returns whichever of the preview or published configuration was updated
last. Values of secret variables are omitted — use export() to get
them.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. |
$response = $client->zaraz()->getConfig('ZONE_ID');
Update Config
Update the Zaraz configuration for a zone.
This writes the preview configuration; call publish() to make it live.
Cloudflare replaces the whole configuration, so send a complete one —
read the current config, change what you need, and send it back.
$config = $client->zaraz()->getConfig('ZONE_ID')->json('result');
$config['debugKey'] = 'new-debug-key';
$client->zaraz()->updateConfig('ZONE_ID', $config);
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
values | array | Yes | The complete configuration: `dataLayer`, `debugKey`, `settings`, `triggers`, `variables`, `tools` and `zarazVersion` are all required, with `analytics`, `consent` and `historyChange` optional. |
$response = $client->zaraz()->updateConfig('ZONE_ID', []);
Get Default
Get the default Zaraz configuration for a zone.
The configuration a zone starts from, useful as a baseline to reset to.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. |
$response = $client->zaraz()->getDefault('ZONE_ID');
Export
Export the published Zaraz configuration for a zone.
Unlike getConfig(), this returns the published configuration in full,
secret variable values included.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. |
$response = $client->zaraz()->export('ZONE_ID');
History
List published Zaraz configuration records for a zone.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
params | array | No | [] | Query Parameters: `offset` (default `0`), `limit` (default `10`), `sortField` (one of `id`, `user_id`, `description`, `created_at`, `updated_at`) and `sortOrder` (`DESC` or `ASC`). |
$response = $client->zaraz()->history('ZONE_ID', []);
Restore
Restore a published Zaraz configuration by ID.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
configId | int | Yes | ID of the historical configuration to restore, as listed by `history()`. |
$response = $client->zaraz()->restore('ZONE_ID', 1);
Configs
Get published Zaraz configurations by ID.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
ids | array | Yes | IDs of the historical configurations to fetch. |
$response = $client->zaraz()->configs('ZONE_ID', []);
Get Workflow
Get the Zaraz workflow for a zone.
The workflow decides which configuration visitors are served: realtime
serves the published one, preview serves the one you are editing.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. |
$response = $client->zaraz()->getWorkflow('ZONE_ID');
Update Workflow
Update the Zaraz workflow for a zone.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
workflow | string | Yes | Either `realtime` or `preview`. |
$response = $client->zaraz()->updateWorkflow('ZONE_ID', 'WORKFLOW');
Publish
Publish the current Zaraz preview configuration for a zone.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
description | string | No | '' | Description recorded against the published configuration, and shown in `history()`. |
$response = $client->zaraz()->publish('ZONE_ID', 'DESCRIPTION');

