Top-Level Fields
Every Ghost RPA script starts with a set of top-level fields that define the basics: what the automation is called, where it starts, which spreadsheet it reads from, and the list of pages that make up the flow. This page explains each field in detail.
Quick Reference
| Field | Type | Required | Description |
|---|---|---|---|
offerName | string or string[] | Yes | Name of the automation — appears in logs and dashboard. |
offerURL | string or string[] | Yes | Starting URL the browser opens when a run begins. |
offergroup | number | No | Group index for linking multiple scripts. Default 0. |
sheet | object | Yes | Spreadsheet type and options. |
sale | boolean | No | Whether the script tracks conversions. Default false. |
sources | object | Yes | The sheet ID your script reads data from. |
pages | array | Yes | List of page definitions — the core of the script. |
popups | array | No | Global popup watchers active throughout the run. |
Minimal Script
Here is the simplest possible script with all required top-level fields. It opens a single URL, fills one field, clicks a button, and writes the result back to the sheet.
{
"offerName": ["example-app.com"],
"offerURL": ["https://example-app.com/apply"],
"offergroup": 0,
"sheet": {
"type": "ghost"
},
"sale": false,
"sources": {
"ghost_sheet_id": "your-sheet-id-here"
},
"pages": [
{
"name": "Application Form",
"detect": {
"url_contains": "/apply",
"selector": "#email"
},
"actions": [
{ "type": "type", "selector": "#email", "value": "{{EMAIL}}" },
{ "type": "click", "selector": "#submit-btn" }
]
},
{
"name": "Thank You",
"detect": { "text": "Thank you" },
"actions": [
{ "type": "sheet_status", "value": "lead" }
]
}
],
"popups": []
}offerName
The name of your automation. This appears in log files, the dashboard, and anywhere the script is identified. Use the website domain or a short descriptive name so you can tell scripts apart at a glance.
Can be a plain string or an array of strings. When you pass an array, the first value is used as the primary name. Most scripts use an array with one entry.
// Single name (most common)
"offerName": ["example-form-site.com"]
69
"offerName": "example-form-site.com"
134
"offerName": ["primary-site.com", "alternate-site.com"]offerURL
The starting URL the browser navigates to when a run begins. This is the first page your automation will see — typically a landing page, form start page, or a URL with query parameters.
Like offerName, this can be a string or an array. Use an array when you want to rotate between multiple landing URLs across runs.
// Single URL
"offerURL": ["https://example.com/get-quote"]
61
"offerURL": [
"https://example.com/get-quote?src=campaign1",
"https://example.com/get-quote?src=campaign2",
"https://example.com/get-quote?src=campaign3"
]Tip: Always include the full URL with https://. If the site redirects from the URL you provide, that's fine — the engine follows redirects automatically and your page detection rules handle whatever page loads next.
offergroup
A numeric index that links multiple scripts together into a group. When several scripts share the same offergroup number, they are treated as part of the same offer — the engine can rotate between them or track their results together.
// Standalone script (most common)
"offergroup": 0
52
"offergroup": 3For most scripts, set this to 0. Only use a higher number when you have multiple scripts that should be grouped together for reporting or rotation.
sheet
Configures which type of spreadsheet the script reads data from and how it interacts with the sheet. The type field is required — it tells the engine whether you are using a Ghost RPA built-in sheet or an external Google Sheet.
// Ghost RPA built-in sheet (most common)
"sheet": {
"type": "ghost",
"use_state_filter": false
}
103
"sheet": {
"type": "google",
"use_state_filter": true
}sheet.type
| Value | Description |
|---|---|
"ghost" | Uses a Ghost RPA built-in spreadsheet. Data is stored inside Ghost RPA and accessed via the sheet ID in sources. |
"google" | Uses an external Google Sheet connected through OAuth. Requires a Google Sheet ID in sources. |
sheet.use_state_filter
When true, the engine filters rows by a US state column and only processes rows that match the current profile's assigned state. Set to false (the default) to process all rows regardless of state.
sale
A boolean that tells the engine whether this script tracks sales or conversions (as opposed to standard leads). Most scripts set this to false.
// Standard form automation (most common)
"sale": false
57
"sale": trueWhen sale is true, the engine uses a different tracking flow — it looks for conversion confirmation pages and can claim VCC (virtual credit card) rows from the sheet for purchase-based automations.
sources
Tells the engine which spreadsheet to read data from. The key you use depends on your sheet.type:
// For Ghost RPA built-in sheets
"sources": {
"ghost_sheet_id": "wb-176768e9-a966-4c43-9cc8-sheet-1"
}
106
"sources": {
"google_sheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms"
}Where to find the sheet ID:
- Ghost sheets — open your sheet in Ghost RPA, the ID is shown in the sheet settings or the URL.
- Google Sheets — open the Google Sheet in your browser. The ID is the long string in the URL between
/d/and/edit.
pages
The core of every script — an array of page definitions that describe the full automation flow. Each entry in this array represents one page or screen the engine might encounter, with rules for how to detect it and actions to perform on it.
"pages": [
{
"name": "Step 1 - Zip Code",
"detect": { "url_contains": "/step-1", "selector": "#zipcode" },
"actions": [
{ "type": "type", "selector": "#zipcode", "value": "{{ZIP}}" },
{ "type": "click", "selector": ".next-btn" }
]
},
{
"name": "Step 2 - Contact Info",
"detect": { "url_contains": "/step-2" },
"actions": [
{ "type": "type", "selector": "#email", "value": "{{EMAIL}}" },
{ "type": "type", "selector": "#phone", "value": "{{PHONE}}" },
{ "type": "click", "selector": ".next-btn" }
]
},
{
"name": "Thank You",
"detect": { "text": "Thank you for your submission" },
"actions": [
{ "type": "sheet_status", "value": "lead" }
]
}
]The engine does not follow pages in order — it continuously scans all page definitions and runs whichever one matches the current browser state. This means your script automatically handles redirects, popups, and multi-path flows where the site can send users down different routes.
For full details on how each page is structured, see Page Object.
popups
An array of global popup watchers that run throughout the entire automation — not just on a specific page. Use this for cookie banners, chat widgets, promotional overlays, or any element that can appear at any time during the flow and needs to be dismissed.
// No global popups
"popups": []
34
"popups": [
{
"name": "Cookie Banner",
"selector": "#cookie-accept-btn",
"action": "click"
},
{
"name": "Chat Widget",
"selector": ".chat-close-btn",
"action": "click"
}
]The difference between popups and a popup_close action inside a page: popups defined here are watched globally across all pages throughout the run, while popup_close inside a page's actions only runs once when that specific page is detected. Use global popups for elements that can appear at any time, and page-level popup_close for popups specific to one step.
Putting It All Together
Here is a complete script with all top-level fields using a real-world loan application form as an example:
{
"offerName": ["example-loan-site.com"],
"offerURL": ["https://example-loan-site.com/"],
"offergroup": 0,
"sheet": {
"type": "ghost",
"use_state_filter": false
},
"sale": false,
"sources": {
"ghost_sheet_id": "your-sheet-id-here"
},
"pages": [
{
"name": "Step 1 - Loan Amount",
"detect": {
"url_contains": "example-loan-site.com",
"mode": "all",
"selector": [
"xpath=//button[contains(normalize-space(),'$500')]",
"xpath=//button[contains(normalize-space(),'$1,000')]"
],
"text": "How Much Do You Need?"
},
"actions": [
{
"type": "click_random",
"selectors": [
"xpath=//button[contains(normalize-space(),'$500')]",
"xpath=//button[contains(normalize-space(),'$1,000')]",
"xpath=//button[contains(normalize-space(),'$2,000')]"
]
}
]
},
{
"name": "Step 2 - Email",
"detect": {
"url_contains": "example-loan-site.com",
"mode": "all",
"selector": "xpath=//*[@id='email']",
"text": "What Is Your Email Address?"
},
"actions": [
{
"type": "type",
"selector": ["xpath=//*[@id='email']", "#email"],
"value": "{{EMAIL}}"
},
{ "type": "wait", "delay": 300 },
{
"type": "click",
"selector": "xpath=//button[contains(normalize-space(),'Next')]"
}
]
},
{
"name": "Step 3 - Name",
"detect": {
"url_contains": "example-loan-site.com",
"mode": "all",
"text": "What Is Your Name?",
"selector": ["xpath=//*[@id='firstName']", "xpath=//*[@id='lastName']"]
},
"actions": [
{
"type": "type",
"selector": ["xpath=//*[@id='firstName']", "#firstName"],
"value": "{{FIRST_NAME}}"
},
{ "type": "wait", "delay": 300 },
{
"type": "type",
"selector": ["xpath=//*[@id='lastName']", "#lastName"],
"value": "{{LAST_NAME}}"
},
{ "type": "wait", "delay": 300 },
{
"type": "click",
"selector": "xpath=//button[contains(normalize-space(),'Next')]"
}
]
}
],
"popups": []
}