User Guide

Request Rule Options

52 views 0

Use this guide to understand the different option available to you when creating a Request Rule within the Zephr Request Rule Builder.

The options that make up a potential rule are broken down between Segments, and Responses. Segments allow you to determine who the rule applies to, and responses specify the outcome of the rule.

The following Segments available within a Request Rule are:

User Segments

  • User Field: Allows you to segment users based on User Schema information stored within their profile. Note: this requires user attributes to be set up within Zephr, and site users to be stored in the Zephr Identity Store.

Session Segments

  • Logged In: For rules based on whether a user is logged in, or not.

Content Segments

  • Path: To create rules for a specific URL path.
  • Metadata: To create rules for content with particular metadata.
  • Content API: When Zephr is connected to your Content API, this option allows you to make decisions based upon the data being returned.
  • Content API Age: When Zephr is connected to your Content API, this option allows you to make decisions based upon the age of the piece of content, provided this is returned by your Content API.

Request Segments

  • Device Type: Define rules for users of specific devices – desktop, mobile, appliances, or crawlers.
  • Verified Crawler?: Define rules specifically for verified crawlers, such as Googlebot.
  • Referrer: Define rules based on a user’s referrer.
  • User Agent: Define rules for users based on user agent.
  • Browser: Define rules for users based on the browser they are using.
  • JWT Token: Define rules for specific JWT tokens

Time Segments

  • Date/Time: For rules required before or after a specific date and time, with the ability to choose a particular time zone, or to use the local time of your user.
  • Date/Time Range: For rules required during a specific date and time period, with the ability to choose a particular time zone, or to use the local time of your user.
  • Time: For rules required before or after a specific time of day – e.g. Before 6am, every day – with the ability to choose a particular time zone, or to use the local time of your user.
  • Time Range: For rules required during a specific time of day – e.g. 6am-8am, every day – with the ability to choose a particular time zone, or to use the local time of your user.

A/B Test Segments

  • A/B Test: Used to create a rule variation based upon an A/B Test Group, as set up via Settings > A/B Tests.

Entitlement Segments

  • Entitlement: Used to make decisions dependent on the presence of a specific entitlement – e.g. If user has x entitlement, do y.
  • Meter Count: Used to determine outcomes dependent on a user’s meter count – e.g. If user has x views remaining, do y.
  • Credit Count: Used to determine outcomes dependent on a user’s credit count – e.g. If user has x credits remaining, do y.

Advanced

  • Multiple Choice: Multiple Choice allows you to create a more simple rule when you want to make variations based on particular segments. For example, if you add Multiple Choice to your canvas, and then drag Device Type into Multiple Choice, you will be able to choose multiple Device Types for your rule, and specify differing outcomes accordingly.
  • OR: Decision point to branch a rule depending on whether a user one of a series of options – e.g. having the Article Entitlement OR the Trial Entitlement. Add OR to your canvas, and then drag in the relevant segment. Following this, you will be able to set your segment details.
  • AND: Decision point to branch a rule based upon a user meeting a series of criteria – e.g. having the Article Entitlement AND the Trial Entitlement. Add AND to your canvas, and then drag in the relevant segment. Following this, you will be able to set your segment details.
  • Custom Decision: Allows you to write a custom script for use as a custom decision point.

The following Responses are available within a Request Rule:

Modify Response

  • Replace Body: Adding this into the flow of a request rule will prompt you to input details for the Body value that you wish to replace.
  • Add Header:  Adding this into the flow of a request rule will prompt you to input details for the header you wish to alter, in the form of a key:value pair.
  • Remove Header: Adding this into the flow of a request rule will prompt you to input details for the header you wish to remove.
  • Clear Headers: Adding this into the flow of a request rule will mean that all origin response headers for the site user are cleared, at the point that users reach this part of the rule.

More information can be found on the above options in our Customising Headers and Body Responses guide.

Responses

  • Allow: Allows access to the request. Returns a 200.
  • Deny: Denies access to the request. Returns a 401.
  • Template Redirect: Allows you to set a redirect with various values. By default, {{path}}, {{contentApi}}, and {{metatags}} are available for use. For further options, use Add to Redirect Scope below.
  • Simple Redirect: Redirects the user to a specified URL.
  • Custom Response Status: Allows you to set a customer response status for the request.
  • Preserve Origin Status: Adding this into the flow of a request rule will ensure the the response code, headers and body of the origin’s response remain unchanged.

Integrations

  • Webhook: Allows you to trigger a webhook within a rule. Note: Requires webhooks to be set up under Settings > Webhooks. Read our Webhooks guide for more information.

Advanced

  • Add to Redirect Scope: Allows you to add a Scope Variable and Value to be used in a Template Redirect.
  • Run Custom Script: Allows you to set a custom script to be run when a decision reaches that point of your rule.

Request Rules also allow you to create Sub-Rules and Sub-Branches within them:

Sub-Rules

  • Run Branch: Allows you to create a Sub-Branch within the current rule.
  • Run Sub-Rule: Allows you to create a Sub-Rule within the current rule.
  • Run Global Branch: Allows you to choose a globally created Request Sub-Branch, and choose the version applicable to your Request rule.
  • Run Global Sub-Rule: Allows you to choose a globally created Request Sub-Rule, and choose the version applicable to your Request rule.

Note: Read our guide to Sub Rules for more information.