Variables & Data Commands
Variables and data commands let you store, calculate, and manipulate data during your automation. These commands are the “glue” that connects different parts of your automation together, allowing you to pass data from one step to the next, perform calculations, transform text, and manage lists of items.
Without these commands, your automation would be limited to static, hard-coded actions. With them, you can create dynamic, data-driven workflows that respond to what they find on each page.

set_variable
Section titled “set_variable”Creates or updates a state variable with a specific value. Variables created with this command are available to all subsequent commands in your automation.
Description
Section titled “Description”The set_variable command stores a value under a named key in your automation’s state. You can then reference this value in any later command using the ${variable_name} syntax. This is the most fundamental way to pass data between commands.
The variable is also injected as a <meta> tag in the page’s DOM, making it accessible to dataset selectors that use the variable= selector type.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | ✅ Yes | — | The name of the variable. Must be unique within your automation. Use this name to reference the variable later with ${name}. |
value |
any | ✅ Yes | — | The value to store. Can be a string, number, boolean, object, or array. Supports ${variable} substitution. |
Examples
Section titled “Examples”Store a simple string:
{ "command": "set_variable", "params": { "name": "search_term", "value": "wireless headphones" }}Store a value from another variable:
{ "command": "set_variable", "params": { "name": "full_url", "value": "https://example.com/search?q=${search_term}" }}Store a calculated value:
{ "command": "set_variable", "params": { "name": "discount_multiplier", "value": 0.85 }}Store a list of items:
{ "command": "set_variable", "params": { "name": "keywords", "value": ["laptop", "tablet", "phone"] }}Behavior Notes
Section titled “Behavior Notes”- If a variable with the same name already exists, its value is overwritten.
- The variable is saved to the checkpoint immediately, so it survives crashes.
- The variable is injected into the page as a
<meta>tag, enablingvariable=selectors in datasets. - Variables created with
set_variableare available in all subsequent commands, including nested commands inside loops and conditionals. - Variables are scoped to the current automation run. They do not persist between separate runs.
- Use descriptive variable names like
product_priceinstead ofxortemp. - Variable names are case-sensitive:
myVarandmyvarare different variables. - Avoid using special characters in variable names. Stick to letters, numbers, and underscores.
- You can overwrite a variable as many times as needed during a run.
math_operation
Section titled “math_operation”Performs a mathematical operation on two values and optionally stores the result in a variable.
Description
Section titled “Description”The math_operation command performs basic arithmetic on two operands. This is useful for calculating prices, computing percentages, counting items, or any other numerical calculation your automation needs.
The result is returned by the command and can be stored in a variable using the output_variable parameter.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
left_operand |
number/string | ✅ Yes | — | The left operand. Can be a number or a ${variable} reference. |
operator |
string | ✅ Yes | + |
The mathematical operator. Options: +, -, *, /, %. |
right_operand |
number/string | ✅ Yes | — | The right operand. Can be a number or a ${variable} reference. |
output_variable |
string | No | — | The name of the variable to store the result in. |
Available Operators
Section titled “Available Operators”| Operator | Name | Example | Result |
|---|---|---|---|
+ |
Addition | 10 + 5 |
15 |
- |
Subtraction | 10 - 5 |
5 |
* |
Multiplication | 10 * 5 |
50 |
/ |
Division | 10 / 5 |
2 |
% |
Modulo (remainder) | 10 % 3 |
1 |
Examples
Section titled “Examples”Add two values:
{ "command": "math_operation", "params": { "left_operand": "${item_price}", "operator": "+", "right_operand": "${shipping_cost}", "output_variable": "total_price" }}Calculate a discount:
{ "command": "math_operation", "params": { "left_operand": "${original_price}", "operator": "*", "right_operand": 0.85, "output_variable": "discounted_price" }}Calculate a percentage:
{ "command": "math_operation", "params": { "left_operand": "${items_found}", "operator": "/", "right_operand": "${total_items}", "output_variable": "percentage_found" }}Check if a number is even (modulo):
{ "command": "math_operation", "params": { "left_operand": "${page_number}", "operator": "%", "right_operand": 2, "output_variable": "is_odd_check" }}Behavior Notes
Section titled “Behavior Notes”- Both operands are converted to numbers before the operation. If conversion fails, the command will error.
- Division by zero will cause an error.
- The modulo operator (
%) returns the remainder of a division. Useful for checking if a number is even/odd. - If
output_variableis not specified, the result is returned but not stored. You would typically useoutput_variableto save the result. - Operands can be
${variable}references, allowing you to use values from earlier commands.
- Use
math_operationinstead ofrun_scriptfor simple calculations. It’s faster and simpler. - For complex calculations, use
run_scriptwith JavaScript instead. - The modulo operator is great for pagination logic (e.g., “do something every 5th page”).
string_operation
Section titled “string_operation”Performs string manipulation operations like splitting, replacing, converting case, and encoding.
Description
Section titled “Description”The string_operation command transforms text values. This is essential for cleaning up scraped data, extracting specific parts of text, formatting output, and preparing data for use in other commands.
The result is stored in the variable specified by output_variable.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
value |
string | ✅ Yes | — | The input string to operate on. Supports ${variable} substitution. |
operation |
string | ✅ Yes | to_upper |
The operation to perform. See operations table below. |
params |
object | No | {} |
Operation-specific parameters. Depends on the chosen operation. |
output_variable |
string | No | — | The name of the variable to store the result in. |
Available Operations
Section titled “Available Operations”| Operation | Description | Required Params |
|---|---|---|
concat |
Concatenates (joins) a value to the end of the string | params.value |
split |
Splits the string into an array using a delimiter | params.delimiter |
replace |
Finds and replaces text using regex | params.find, params.replace_with, params.flags |
to_upper |
Converts the string to UPPERCASE | None |
to_lower |
Converts the string to lowercase | None |
trim |
Removes whitespace from the start and end | None |
url_encode |
URL-encodes the string (encodes special characters) | None |
Operation Details
Section titled “Operation Details”concat
Section titled “concat”Joins another string to the end of the input string.
| Param | Type | Description |
|---|---|---|
params.value |
string | The string to append to the end. |
{ "command": "string_operation", "params": { "value": "Product: ", "operation": "concat", "params": { "value": "${product_name}" }, "output_variable": "full_product_label" }}Splits a string into an array using a delimiter character.
| Param | Type | Description |
|---|---|---|
params.delimiter |
string | The character(s) to split on (e.g., ,, ;, ). |
{ "command": "string_operation", "params": { "value": "red,blue,green", "operation": "split", "params": { "delimiter": "," }, "output_variable": "color_list" }}Result: color_list = ["red", "blue", "green"]
replace
Section titled “replace”Finds text matching a pattern and replaces it with new text. Uses JavaScript regular expressions.
| Param | Type | Description |
|---|---|---|
params.find |
string | The regex pattern to find. |
params.replace_with |
string | The text to replace matches with. |
params.flags |
string | Regex flags (e.g., g for global, i for case-insensitive). |
{ "command": "string_operation", "params": { "value": "$29.99 USD", "operation": "replace", "params": { "find": "[$]", "replace_with": "", "flags": "g" }, "output_variable": "clean_price" }}Result: clean_price = "29.99 USD"
to_upper
Section titled “to_upper”Converts the entire string to UPPERCASE.
{ "command": "string_operation", "params": { "value": "${product_name}", "operation": "to_upper", "output_variable": "upper_name" }}to_lower
Section titled “to_lower”Converts the entire string to lowercase.
{ "command": "string_operation", "params": { "value": "${product_name}", "operation": "to_lower", "output_variable": "lower_name" }}Removes whitespace (spaces, tabs, newlines) from the beginning and end of the string.
{ "command": "string_operation", "params": { "value": " ${scraped_text} ", "operation": "trim", "output_variable": "clean_text" }}url_encode
Section titled “url_encode”URL-encodes the string, replacing special characters with their percent-encoded equivalents. Essential for building URLs with user input.
{ "command": "string_operation", "params": { "value": "wireless headphones & speakers", "operation": "url_encode", "output_variable": "encoded_search" }}Result: encoded_search = "wireless%20headphones%20%26%20speakers"
Behavior Notes
Section titled “Behavior Notes”- The
valueparameter supports${variable}substitution, so you can operate on values from earlier commands. - If
output_variableis not specified, the result is returned but not stored. - The
replaceoperation uses JavaScript regex syntax. Special regex characters in thefindpattern must be escaped. - The
splitoperation returns an array. You can use this array in afor_eachloop. - Operations are case-sensitive unless you use the
iflag withreplace.
- Chain multiple
string_operationcommands to perform complex text transformations. - Use
trimafter scraping text to remove unwanted whitespace. - Use
url_encodebefore inserting user input into URLs to prevent broken URLs. - Use
splitto break apart comma-separated values, then loop through them withfor_each.
list_operation
Section titled “list_operation”Performs operations on list (array) variables, including creating, adding to, removing from, and splitting strings into lists.
Description
Section titled “Description”The list_operation command manages list variables. Lists are ordered collections of items that you can loop through with for_each commands. This command lets you build lists dynamically during your automation.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
variable |
string | ✅ Yes | — | The name of the list variable to operate on. |
operation |
string | ✅ Yes | create |
The operation to perform. Options: create, push, pop, split_string. |
value |
any | No | — | The value to push (for push) or the string to split (for split_string). |
delimiter |
string | No | , |
The delimiter to use when splitting a string (for split_string). |
Available Operations
Section titled “Available Operations”| Operation | Description | Requires value? |
Requires delimiter? |
|---|---|---|---|
create |
Creates a new empty list | No | No |
push |
Adds a value to the end of the list | ✅ Yes | No |
pop |
Removes the last item from the list | No | No |
split_string |
Splits a string into a list using a delimiter | ✅ Yes | ✅ Yes |
Operation Details
Section titled “Operation Details”create
Section titled “create”Creates a new empty list variable.
{ "command": "list_operation", "params": { "variable": "collected_urls", "operation": "create" }}Adds a value to the end of an existing list.
{ "command": "list_operation", "params": { "variable": "collected_urls", "operation": "push", "value": "${current_page_url}" }}Removes the last item from the list.
{ "command": "list_operation", "params": { "variable": "collected_urls", "operation": "pop" }}split_string
Section titled “split_string”Splits a string into a list using a delimiter. The result replaces the variable’s value.
{ "command": "list_operation", "params": { "variable": "tag_list", "operation": "split_string", "value": "electronics,computers,laptops", "delimiter": "," }}Result: tag_list = ["electronics", "computers", "laptops"]
Behavior Notes
Section titled “Behavior Notes”createinitializes an empty list. If the variable already exists, it is overwritten with an empty list.pushappends to the end of the list. If the variable doesn’t exist, it is created as a new list with the pushed value.popremoves the last item. If the list is empty, nothing happens.split_stringreplaces the variable’s value with the resulting array. The original string value is lost.- Lists created with
list_operationcan be used infor_eachloops. - The
valueparameter forpushsupports${variable}substitution.
- Use
createat the start of your automation to initialize lists you’ll build up during the run. - Use
pushinside loops to collect data from multiple pages. - Use
split_stringto convert comma-separated or semicolon-separated data into a loopable list. - Combine
list_operationwithfor_eachto process each item in a list. - Lists are stored in the automation state and survive checkpoint saves.
Combining Variables & Data Commands
Section titled “Combining Variables & Data Commands”Here’s a practical example showing how these commands work together in a real automation:
[ { "command": "set_variable", "params": { "name": "base_price", "value": 29.99 } }, { "command": "set_variable", "params": { "name": "tax_rate", "value": 0.08 } }, { "command": "math_operation", "params": { "left_operand": "${base_price}", "operator": "*", "right_operand": "${tax_rate}", "output_variable": "tax_amount" } }, { "command": "math_operation", "params": { "left_operand": "${base_price}", "operator": "+", "right_operand": "${tax_amount}", "output_variable": "total_price" } }, { "command": "string_operation", "params": { "value": "Total: $${total_price}", "operation": "concat", "params": { "value": " (tax included)" }, "output_variable": "price_label" } }, { "command": "list_operation", "params": { "variable": "price_history", "operation": "create" } }, { "command": "list_operation", "params": { "variable": "price_history", "operation": "push", "value": "${total_price}" } }]This example calculates a price with tax, formats a label, and stores the price in a history list.