Skip to main content

What are Variables?

Variables are named placeholders that carry data from one step to the next. When a Pull Stats step fetches your affiliate stats, each cell of data is stored as a variable — for example, {affiliate_name_1_stats_1} or {revenue_2_stats_1}. You then insert those variables into your email body, invoice template, or condition check, and AffZero replaces them with real values when the automation runs.

Variable Naming Convention

Variables follow a consistent pattern depending on which step produced them:

Pull Stats Variables

{column_name_row_index_stats_N}
Where:
  • column_name — the data column (e.g. affiliate_name, revenue, payout, clicks, conversions)
  • row_index — which row of the results (1-based: first row = 1, second row = 2, etc.)
  • N — which Pull Stats step in the automation (first Pull Stats step = 1, second = 2, etc.)
Examples:
VariableWhat it contains
{affiliate_name_1_stats_1}Name of the affiliate in row 1 from the first Pull Stats step
{revenue_1_stats_1}Revenue for row 1, first Pull Stats step
{payout_2_stats_1}Payout for row 2, first Pull Stats step
{affiliate_name_1_stats_2}Affiliate name from row 1 of the second Pull Stats step

AI Analyze Variables

The AI Analyze step produces custom named variables based on your instruction. For example, if you tell the AI to “find the top affiliate by revenue”, it might produce:
  • {top_affiliate} — the name
  • {top_affiliate_revenue} — the revenue value
These names are chosen by the AI, so you can copy them from the Variables Available panel after running the step.

Generate Invoice Number Variable

{invoice_number}
The name is user-defined when you configure the step (defaults to invoice_number).

Tracker Action Get Variables

{field_path_action_N}
Where field_path is the API response field you selected, and N is the step index.

How to Select Variables (in Pull Stats)

Variables from Pull Stats are only created for the cells you explicitly select in the test pull:
  1. Run a test pull in the Pull Stats step to fetch a data preview
  2. Click on individual cells in the table to select them
  3. Selected cells are highlighted — they’re now registered as variables
  4. You can see all registered variables in the Variables Available panel
Only selected cells become variables. If you don’t click a cell, that data won’t be available downstream — even if it appears in the test pull table.

Entity Matching — Why Row 1 Stays Row 1

When the automation runs for real (not a test pull), the stats data may come back in a different order depending on how the tracker API returns results on that day. AffZero handles this by tracking the entity ID (e.g. the affiliate’s internal ID) instead of just the row position. When AffZero fetches fresh data during a run:
  1. It looks up the entity ID you selected (e.g. Affiliate ID 123)
  2. Finds that entity in the fresh results — regardless of which row it’s in
  3. Extracts the variable values from that matched row
This means {affiliate_name_1_stats_1} always refers to the same affiliate, not just whoever happens to be in row 1 on that particular day.
If an affiliate is not present in the fresh stats (e.g. they had no activity that week), AffZero falls back to the row position from your test pull, and ultimately to the test value you saw when you selected the cell. You’ll see a warning in the run log if this happens.

How to Insert Variables

Variables can be used in:
  • Email subject line — type { to start or use the Variables panel to copy and paste
  • Email body — click the variable name in the Variables Available panel to insert it at the cursor position
  • Invoice HTML template — type the variable name directly in the HTML
  • Invoice filename — include variables like {affiliate_name_1_stats_1} in the filename field
  • Condition Check — reference variables in condition rules (e.g. {revenue_1_stats_1} is greater than 5000)
  • Google Sheets — map variable values to specific columns

Variables Available Panel

Every step that consumes variables (Send Email, Condition Check, Create Invoice, etc.) shows a Variables Available panel on the left side of the step editor. This panel lists every variable from all previous data-producing steps.
  • Click a variable name to copy it
  • Use the Insert button to place it at the current cursor position in the editor
  • Variables from multiple Pull Stats steps are grouped by step for clarity

Multi-Step Variable Example

Step 1: Pull Stats (Affise, By Affiliate, Last 7 Days)
  → {affiliate_name_1_stats_1}, {revenue_1_stats_1}, {payout_1_stats_1}
  → {affiliate_name_2_stats_1}, {revenue_2_stats_1}, {payout_2_stats_1}

Step 2: AI Analyze ("Identify top performer and flag any payout < $100")
  → {top_affiliate}, {low_payout_count}, {low_payout_affiliates}

Step 3: Send Email
  → Can use ANY variable from Step 1 and Step 2
  → Subject: "Weekly report — top performer: {top_affiliate}"
  → Body: "Revenue leader: {top_affiliate} | {affiliate_name_1_stats_1}: {payout_1_stats_1}"