Evaluator Creation Flow

Created: April 13, 2023

Updated: April 26, 2023

Author: Anastasia N.

What is an Evaluator

An evaluator is JavaScript code that runs on a page and generates a value based on the available information on that page. The value can be generated from a specific element on the page, or as a result of processing the content of a selected element, information stored in cookies, or data stored in a dataLayer.

The value generated from the evaluator can be used for several purposes:

  • Advanced Targeting: Evaluators can extract specific data from a web page. For example, if information about the user's age is stored in data attributes on the page, the evaluator can return this information, allowing targeting based on the user's age.

  • Variations: For example, if it's possible to retrieve the user's name from the page, the evaluator can return this name as a value. This value can then be used in personalized communication with the user.

  • Filtering Rules: Evaluators can help in creating filtering rules. For example, the evaluator can return the difference between the current shopping cart's cost and the free shipping threshold. Then, the user can be offered only those products that cost more than this difference.

The evaluator code runs only when an experience that utilizes the evaluator is loaded on the page. Evaluators can run both synchronously and asynchronously.

The code execution timeout for the evaluator is 4 seconds. If the evaluator doesn't return a value within this time frame, it will return "False".

Example

new Promise(function (resolve, reject) {
  if (!window.location.pathname.includes('/search/')) {
    resolve('not search');
  } else {
      GF.waitForElement('h1', () => {
          resolve((document.querySelectorAll('aside').length === 0).toString());
      })
  }
});

This evaluator checks whether the performed search is empty.

Creating an Evaluator

  1. Button to go to evaluator creation.

Creating a New Evaluator

  1. Evaluator name.

  2. Evaluator description.

  3. Expected values of the evaluator (if the set of expected values is limited).

  4. Evaluator code.

Editing an Evaluator

  1. Switch to editing mode by clicking on the "pencil" icon.

Editing an Existing Evaluator

  1. Evaluator name.

  2. Evaluator description.

  3. Expected values of the evaluator (if the set of expected values is limited).

  4. Evaluator code.

Last updated

Was this helpful?