Skip to content

Commit

Permalink
[zaraz] Update zaraz docs with Automated action updates and move acti…
Browse files Browse the repository at this point in the history
…ons docs (#16985)

* [zaraz] Update zaraz docs with Automated action and move actions docs

* [Zaraz] content rearranging for automatic actions

* Update src/content/docs/zaraz/custom-actions/additional-fields.mdx

Co-authored-by: Jun Lee <junlee@cloudflare.com>

* Update src/content/docs/zaraz/custom-actions/create-action.mdx

Co-authored-by: Jun Lee <junlee@cloudflare.com>

* Update src/content/docs/zaraz/get-started.mdx

Co-authored-by: Jun Lee <junlee@cloudflare.com>

* Update src/content/docs/zaraz/get-started.mdx

Co-authored-by: Simona Badoiu <simonaandreea.badoiu@gmail.com>

* Update src/content/docs/zaraz/get-started.mdx

Co-authored-by: Jun Lee <junlee@cloudflare.com>

---------

Co-authored-by: Yo'av Moshe <yoav@cloudflare.com>
Co-authored-by: Yo'av Moshe <github@yoavmoshe.com>
Co-authored-by: Jun Lee <junlee@cloudflare.com>
Co-authored-by: Simona Badoiu <simonaandreea.badoiu@gmail.com>
  • Loading branch information
5 people authored Sep 24, 2024
1 parent fdd4ee0 commit d20fef9
Show file tree
Hide file tree
Showing 31 changed files with 312 additions and 381 deletions.
10 changes: 10 additions & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,16 @@
/zaraz/advanced/block-zaraz/ /zaraz/advanced/load-selectively/ 301
/zaraz/web-api/zaraz-track/ /zaraz/web-api/track/ 301
/zaraz/pricing/ /zaraz/pricing-info/ 301
/zaraz/get-started/add-tool/ /zaraz/get-started/ 301
/zaraz/get-started/create-actions/ /zaraz/custom-actions/ 301
/zaraz/get-started/create-trigger/ /zaraz/custom-actions/create-trigger/ 301
/zaraz/get-started/additional-fields/ /zaraz/custom-actions/additional-fields/ 301
/zaraz/get-started/edit-tools-and-actions/ /zaraz/custom-actions/edit-tools-and-actions/ 301
/zaraz/get-started/edit-triggers/ /zaraz/custom-actions/edit-triggers/ 301
/zaraz/get-started/edit-variables/ /zaraz/variables/edit-variables/ 301
/zaraz/get-started/create-variables/ /zaraz/variables/create-variables/ 301
/zaraz/advanced/worker-variables/ /zaraz/variables/worker-variables/ 301
/zaraz/history/history/ /zaraz/history/versions/ 301

# cloudflare-one / zero-trust
/access/common-access-configurations/common-bypass/ /cloudflare-one/policies/access/#bypass 301
Expand Down
7 changes: 2 additions & 5 deletions src/content/docs/zaraz/advanced/blocking-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ pcx_content_type: reference
title: Blocking Triggers
sidebar:
order: 2

---

Blocking Triggers are triggers that instead of being used to define when to start an action, are used to define when to *not* start an action. You may need to block one or more actions in a tool from firing when a specific condition arises. For these cases, you can set Blocking Triggers.
Blocking Triggers are triggers that instead of being used to define when to start an action, are used to define when to _not_ start an action. You may need to block one or more actions in a tool from firing when a specific condition arises. For these cases, you can set Blocking Triggers.

Every tool action has Firing Triggers assigned to it. Blocking Triggers are optional and, if defined, will conditionally prevent the action from starting. When you add Blocking Triggers to an action, the action will not fire if any of its Blocking Triggers are true. If the tool has more than one action, other actions without these Blocking Triggers will still work.

To conditionally block all actions in a tool, you have to configure Blocking Triggers on every action that belongs to that tool. Note that when you use Blocking Triggers, Zaraz will still load on the page.

To use Blocking Triggers, start by [creating the trigger](/zaraz/get-started/create-trigger/) with the conditions you want to use to block an event. Then:
To use Blocking Triggers, start by [creating the trigger](/zaraz/custom-actions/create-trigger/) with the conditions you want to use to block an event. Then:

1. Go to [**Zaraz**](https://dash.cloudflare.com/?to=/:account/:zone/zaraz) > **Tools Configuration**.
2. Under **Third-party tools**, locate the tool with the action you want to block and select **Edit**.
Expand All @@ -22,8 +21,6 @@ To use Blocking Triggers, start by [creating the trigger](/zaraz/get-started/cre

:::note


Blocking Triggers are useful if you wish to block specific actions, or even specific tools from firing, while keeping others active. If you wish to turn off Zaraz entirely on specific pages/domains/subdomains, or load Zaraz depending on other factors such as cookies, we recommend [loading Zaraz selectively](/zaraz/advanced/load-selectively/).


:::
2 changes: 1 addition & 1 deletion src/content/docs/zaraz/advanced/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pcx_content_type: navigation
title: Advanced options
sidebar:
order: 8
order: 7

---

Expand Down
41 changes: 20 additions & 21 deletions src/content/docs/zaraz/advanced/load-custom-managed-component.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
pcx_content_type: how-to
title: Load Custom Managed Components
title: Custom Managed Components
sidebar:
order: 15

---

Zaraz supports loading custom third-party tools using [Managed Components](https://managedcomponents.dev/). These can be Managed Components that you have developed yourself or that were developed by others. Using Custom Managed Components with Zaraz is done by converting them into a Cloudflare Worker running in your account.
Expand All @@ -14,7 +13,7 @@ If you are new to Managed Components, we recommend you get started with [creatin

:::note

If your Managed Component requires any building, transpiling, or bundling, you must complete those steps before you can deploy it. For example, this is required for components written in TypeScript and is usually done by running `npm run build` or an equivalent.
If your Managed Component requires any building, transpiling, or bundling, you must complete those steps before you can deploy it. For example, this is required for components written in TypeScript and is usually done by running `npm run build` or an equivalent.
:::

To get started, you need have a JavaScript file ready for deployment, that exports the default Managed Component function for your Managed Component.
Expand All @@ -24,20 +23,20 @@ In this guide, we will use a simple example of a Custom Managed Component that c
```javascript
// File: index.js
export default async function (manager) {
// Add a pageview event
manager.addEventListener("pageview", event, () => {
const { client } = event;
// Add a pageview event
manager.addEventListener("pageview", event, () => {
const { client } = event;

// Get the variable "counter" from the client's cookies and increase by 1
let counter = parseInt(client.get("counter")) || 0;
counter += 1;
// Get the variable "counter" from the client's cookies and increase by 1
let counter = parseInt(client.get("counter")) || 0;
counter += 1;

// Log the increased number
client.execute(`console.log('Views: ${counter}')`);
// Log the increased number
client.execute(`console.log('Views: ${counter}')`);

// Store the increased number for the next visit
client.set("counter", counter);
});
// Store the increased number for the next visit
client.set("counter", counter);
});
}
```

Expand All @@ -51,26 +50,26 @@ export default async function (manager) {

:::note

As with regular tools, it is recommended that you [create the triggers](/zaraz/get-started/create-trigger/) you need first, if the Custom Managed Component you are adding needs to start actions using firing triggers different from the default `Pageview` trigger.
As with regular tools, it is recommended that you [create the triggers](/zaraz/custom-actions/create-trigger/) you need first, if the Custom Managed Component you are adding needs to start actions using firing triggers different from the default `Pageview` trigger.
:::

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
2. Select **Zaraz** > **Tools Configuration** > [**Third-party tools**](https://dash.cloudflare.com/?to=/:account/:zone/zaraz/tools-config/tools/catalog).
3. Select **Add new tool** and choose **Custom Managed Component** from the tools library page. Select **Continue** to confirm your selection.
4. In **Select Custom MC**, choose a Custom Managed Component that you have deployed to your account, such as `custom-mc-my-new-counter-mc`. Select **Continue**.
5. In **Permissions**, select the permissions you want to grant the Custom Managed Component. If you run an untrusted Managed Component, pay close attention to what permissions you are granting. Select **Continue**.
6. In **Set up**, configure the settings for your new tool. The information you need to enter will depend on the code of the Managed Component. You can add settings and default fields, as well as use [variables you have previously set up](/zaraz/get-started/create-variables/).
6. In **Set up**, configure the settings for your new tool. The information you need to enter will depend on the code of the Managed Component. You can add settings and default fields, as well as use [variables you have previously set up](/zaraz/variables/create-variables/).
7. Select **Save**.

While your tool is now configured, it does not have any actions associated with it yet. Adding new actions will tell Zaraz when to contact your Managed Component, and what information to send to it. When adding actions, make sure to verify the Action Type you are using. The types `pageview` and `event` are most commonly used, but you can add any action type to match the event listeners your Managed Component is using. Learn how to [create additional actions](/zaraz/get-started/create-actions/).
While your tool is now configured, it does not have any actions associated with it yet. Adding new actions will tell Zaraz when to contact your Managed Component, and what information to send to it. When adding actions, make sure to verify the Action Type you are using. The types `pageview` and `event` are most commonly used, but you can add any action type to match the event listeners your Managed Component is using. Learn how to [create additional actions](/zaraz/custom-actions/).

If your Managed Component listens to `ecommerce` events, toggle **E-commerce tracking** in the Managed Component Settings page.

## Unsupported Features

As of now, Custom Managed Components do not support the use of the following methods yet:

* `manager.registerEmbed`
* `manager.registerWidget`
* `manager.proxy`
* `manager.serve`
- `manager.registerEmbed`
- `manager.registerWidget`
- `manager.proxy`
- `manager.serve`
2 changes: 1 addition & 1 deletion src/content/docs/zaraz/consent-management/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pcx_content_type: reference
title: Consent management
sidebar:
order: 6
order: 5
head:
- tag: title
content: Zaraz Consent Management platform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ sidebar:

---

Almost all tools in the Tools Library require that you enter information in more than one field to be properly configured. Beyond these required default fields, some tools let you add additional fields.

If we take Universal Google Analytics as an example, a default field would be your GA Property ID (the Google Analytics account ID), and an example of an additional field would be a Custom Dimension (like Custom Dimension 1).
Some tools supported by Zaraz let you add fields in addition to the required field. Fields can usually be added either to a specific action, or to all the action within a tool, by adding the field as a **Default Field**.

## Add an additional field to a specific action

Expand All @@ -20,7 +18,7 @@ Adding an additional field to an action will attach it to this action only, and
4. Select the action you wish to modify.
5. Select **Add Field**.
6. Choose the desired field from the drop-down menu and select **Add**.
7. Enter the variable you wish to pass to the action.
7. Enter the value you wish to pass to the action.
8. Select **Save**.

The new field will now be used in this event.
Expand All @@ -34,7 +32,7 @@ Adding an additional field to the tool sets it as a default field for all of the
3. Locate the third-party tool where you want to add the field, and select **Edit**.
4. Select **Settings** > **Add Field**.
5. Choose the desired field from the drop-down menu, and select **Add**.
6. Enter the variable you wish to pass to all the actions in the tool.
6. Enter the value you wish to pass to all the actions in the tool.
7. Select **Save**.

The new field will now be attached to every action that belongs to the tool.
21 changes: 21 additions & 0 deletions src/content/docs/zaraz/custom-actions/create-action.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
pcx_content_type: how-to
title: Create an action
sidebar:
order: 2
---

Once you have your triggers ready, you can use them to configure your actions. An action defines a specific task that your tool will perform.

To create an action, first [add a third-party tool](/zaraz/get-started/). If you have already added a third-party tool, follow these steps to create an action.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account and domain.
2. Go to **Zaraz** > **Tools Configuration**.
3. Under **Third-party tools**, locate the tool you want to configure an action for, and select **Edit**.
4. Under Custom actions select **Create action**.
5. Give the action a descriptive name.
6. In the **Firing Triggers** field, choose the relevant trigger or triggers you [previously created](/zaraz/custom-actions/create-trigger/). If you choose more than one trigger, the action will start when any of the selected triggers are matched.
7. Depending on the tool you are adding an action for, you might also have the option to choose an **Action type**. You might also need to fill in more fields in order to complete setting up the action.
8. Select **Save**.

The new action will appear under **Tool actions**. To edit or disable/enable an action, refer to [Edit tools and actions](/zaraz/custom-actions/edit-tools-and-actions/).
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ pcx_content_type: how-to
title: Create a trigger
sidebar:
order: 2

---

Triggers define the conditions under which a tool will start an action. Since a tool must have actions in order to work, and actions must have triggers, it is important to set up your website's triggers correctly. A trigger can be made out of one or more Rules. Zaraz supports [multiple types of Trigger Rules](/zaraz/reference/triggers/).

To create a trigger, first [add a third-party tool](/zaraz/get-started/add-tool/). If you have already added a third-party tool, follow these steps to create a triger.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account and domain.
2. Go to **Zaraz** > **Tools Configuration**.
3. Select the **Triggers** tab.
4. Select **Create trigger**.
5. In **Trigger Name** enter a descriptive name for your trigger.
6. In **Rule type**, choose from the actions available in the drop-down menu to start building your rule. Refer to [Triggers and rules](/zaraz/reference/triggers/) for more information on what each rule type means.
7. In **Variable name**, input the variable you want as the trigger. For example, use *Event Name* if you are using [`zaraz.track()`](/zaraz/web-api/track/) in your website. If you want to use a variable you have previously [created in Variables](/zaraz/get-started/create-variables/), select the `+` sign in the drop-down menu, scroll to **Variables**, and choose your variable.
7. In **Variable name**, input the variable you want as the trigger. For example, use _Event Name_ if you are using [`zaraz.track()`](/zaraz/web-api/track/) in your website. If you want to use a variable you have previously [created in Variables](/zaraz/variables/create-variables/), select the `+` sign in the drop-down menu, scroll to **Variables**, and choose your variable.
8. Use the **Match operation** drop-down list to choose a comparison operator. For an expression to match, the value in **Variable name** and **Match string** must satisfy the comparison operator.
9. In **Match string**, input the string that completes the rule.
10. You can add more than one rule to your trigger. Select **Add rule** and repeat steps 5-8 to add another set of rules and conditions. If you add more than one rule, your trigger will only be valid when all conditions are true.
11. Select **Save**.

Your trigger is now complete. If you go back to the main page you will see it listed under **Triggers**, as well as which tools use it. You can also [**Edit** or **Delete** your trigger](/zaraz/get-started/edit-triggers/).
Your trigger is now complete. If you go back to the main page you will see it listed under **Triggers**, as well as which tools use it. You can also [**Edit** or **Delete** your trigger](/zaraz/custom-actions/edit-triggers/).
15 changes: 15 additions & 0 deletions src/content/docs/zaraz/custom-actions/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
pcx_content_type: how-to
title: Custom actions
sidebar:
order: 2
head:
- tag: title
content: Create a third-party tool action
---

Tools on Zaraz must have actions configured in order to do something. Often, using Automatic Actions is enough for configuring a tool. But you might want to use Custom Actions to create a more customized setup, or perhaps you are using a tool that does not support Automatic Actions. In these cases, you will need to configure Custom Actions manually.

Every action has firing triggers assigned to it. When the conditions of the firing triggers are met, the action will start. An action can be anything the tool can do - sending analytics information, showing a widget, adding a script and much more.

To start using actions, first [create a trigger](/zaraz/custom-actions/create-trigger/) to determine when this action will start. If you have already set up a trigger, or if you are using one of the built-in triggers, follow these steps to [create an action](/zaraz/custom-actions/create-action/).
2 changes: 1 addition & 1 deletion src/content/docs/zaraz/embeds.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pcx_content_type: get-started
title: Embeds
sidebar:
order: 7
order: 6

---

Expand Down
Loading

0 comments on commit d20fef9

Please sign in to comment.