Zephr Classic User Guide

Request Sub Rules and Branches

4 views 0

Global Request Rules are Sub Rules that can be used within any Request Rule you create.

They are managed within the Rules tab of your Zephr Admin Console and can be found by navigating to Rules > Request Sub Rules.

Sub Rules section of the Admin Console

Within this section, you will see two lists. The first, Sub Rules, provides a list of Sub Rules that have been created. The second, Sub Branches, shows a list of Sub Branches that have been created. Sub Rules are used in the middle of a Rule and cannot be used to finish a rule, whilst Sub Branches sit at the end of a Rule and you to modify the response of a Request Rule, as you would in a regular Rule.

Creating a Request Sub Rule

From within the Request Sub Rules screen, click Add Sub Rule and you’ll navigate to the Rule Builder.

For Sub Rules, the rule builder is almost identical to a regular Request Rule, except for one key difference. Sub Rules have a blue node for Start Sub Rule, and an additional blue node for Finish Sub Rule. This is because Sub Rules allow you to condense more complex logic into the middle of a Request Rule within a single node, so you don’t have a clutter canvas when making complex decisions. Every thing you put within this Sub Rule will be viewed as a single node when added to a Request Rule.

In the example below, you’ll see the Sub Rule checks the user’s referrer, and adds a variable to the redirect scope based upon this.

Referrer Check Sub Rule

When the Sub Rule finishes, the Finish Sub Rule becomes linked to the rest of the rule, and the variables set within the Sub Rule form part of the Template Redirect, as seen below by the Sub Rule in red. Details of how to add a Sub Rule to a Request Rule can be found below.

A sub rule node in use within a request rule.

Name your Sub Rule, add the logic, and click Add Sub Rule. Once saved, you’ll be directed to the version control screen of that Sub Rule.

Creating a Request Sub Branch

From within the Request Sub Rules screen, click Add Sub Branch and you’ll navigate to what you know as the Rule Builder.

Unlike Sub Rules, Sub Branches allow you to create rule sets with Responses at the end of them, such as Allow, Deny, or Redirect. They allow you to group a series of outcomes into a single node within your Request Rule.

In the example below, you’ll see a Sub Branch for a device based offers. Whilst a more simple rule may use a single redirect for all users, this rule uses a different redirect depending on the user’s device type, allowing us to offer different offers depending on device being used.

Sub Branch with branches for device based offers

When the Sub Branch is added to a Request Rule, it appears as a single node. In this example, when a user doesn’t have the Print Entitlement, the ‘Device Based Offer’ Sub Branch will run and determine the redirect the user will receive. Details of how to add a Sub Branch to a Request Rule can be found below.

Sub Branch Node within Request Rule

 

Name your Sub Branch, add the logic, and click Add Sub Branch. Once saved, you’ll be directed to the version control screen of that Sub Branch.

Versioning your Sub Rules and Branches

Like traditional Request Rules, Global Sub Rules and Sub Branches use version control. This means that if you have created your Sub Rule or Branch under Rules > Request Sub Rules you’ll be able to navigate back to the rule and edit or add to it as you choose.

Each time you save, a new version will be created. Creating a new version will not update the version of the Sub Rule in use within a Request Rule. You will need to navigate to the Request Rule and update the version number. See below for more details.

Using your Sub Rules and Branches within a Request Rule

To use a Global Sub Rule or Sub Branch within a Request Rule, navigate to the relevant Request Rule and select the Sub Rule option from your Rule Builder Canvas.

Shows Sub Rule Node options within the Rule Builder

When you have Global Sub Rules and Sub Branches created, you will see four options:

  • Run Branch: Create a Sub Branch within the Rules Builder. Note: These are not version controlled and can only be used in a single rule.
  • Run global sub-rule: Choose a Sub Rule and version from Sub Rules you have created under Rules > Request Sub Rules.
  • Run sub-rule: Create a Sub Rule within the Rules Builder. Note: These are not version controlled and can only be used in a single rule.
  • Run global branch: Choose a Sub Branch and version from Sub Branches you have created under Rules > Request Sub Rules.

When choosing one of the Global options a modal will appear over the Rule Builder Canvas. Choose the Sub Rule or Sub Branch you wish to use from the list, along with the version you wish to add to your rule.

Once selected, your Sub Rule will sit within your Request Rule as a single node. Double click on this node to adjust the version that is in use.