Audisto Scripting Language

Syntax and Features of the Audisto Scripting Language

The Audisto Scripting Language is used to define URL Rewrites, and Clusters. You'll notice it whenever clusters or rewrites are displayed.

While the syntax differs for rewrites and clusters, all scripts contain

  • Entities
  • Conditions

Given the following example:

CLUSTER "Product Pages" IS:
  Path Starts With "/products"
CLUSTER is the entity and Starts With "/products" is a condition.

Entities

An entity generally is defined using the statement IS: along with the entity specific keyword.

The following entities are supported:

Entities can be anonymous:

RULE IS:
CLUSTER IS:

Optionally, entities can be named, by adding a quoted string.

RULE "Remove Double Slashes" IS:
CLUSTER "Product Pages" IS:

A more detailed description can be added. Everything after double slashes is treated as a description. Descriptions are allowed to span multiple lines.

RULE "Remove Double Slashes" IS:
  // Sometimes there are double slashes in URLs
  // This has been filed as ticket #2251
  // Until we get rid of this, we rewrite them

Conditions

Conditions consists of so-called scopes and matchers. Scopes extract data from a source - like the path of a URL, or the HTTP status or HTML from a HTTP response. Matchers run tests against the extracted data.

In the following example, the scope is Path, the matcher is Starts With, taking "/user" as an argument. It will become TRUE, if the path of the URL starts with "/user".

Path Starts With "/users"

There's more detailed documentation on scopes and matchers.

Some more examples of scopes and matchers:

HTML Contains "No Products Found"
HTTP Header Contains "Last-Modified"
Response Time Less Than 700

Conditions can be combined with AND and OR.

Path Starts With "/users" AND HTTP Status Equals 200
Response Time Greater Than 700 OR Compressed Content Size Greater Than 40000

Brackets ( and ) can be used to group logical expressions.

Path Starts With "/users" AND
  (HTTP Status Equals 200 OR HTTP Status Equals 302)

Especially if AND and OR are combined, brackets should be used to avoid ambiguities.

Without brackets, expressions are evaluated from left to right.

Case Sensitivity

The Audisto Scripting Language is case insensitive regarding keywords. It also ignores white space like spaces or new lines. The following two statements are identical:

CLUSTER "Product Pages" IS:
  Path Starts With "/products"
cluster "Product Pages" iS : PATH starts     wITh "/products"

Code is formatted automatically upon saving.

Quoted Values

Whenever strings are used, either as names or as arguments, they must be quoted using double quotes.

Inside double quotes, double quotes itself must be escaped using the backslash character \. A backslash must be replaced by two backslashes:

  • \ => \\
  • " => \"

The following code will scan HTML for href="mailto:

CLUSTER "Has Mail Link" IS:
  HTML Contains "href=\"mailto:"

Note that quoting is only required in text editing mode, not when using the visual editor.