Skip to content

Command Line Interface (CLI) ​

SpotLift provides a full-featured Command Line Interface (CLI) for running attribution passes, pre-flight data quality audits, constrained budget optimization, and generating production clean-room SQL.


1. Quick Reference ​

bash
# Run the instant interactive terminal demo
spotlift demo

# Run pre-flight schema, cadence, and collision audit
spotlift preflight --spots schaltplan.csv --web ga4_minutes.parquet

# Run causal attribution across broadcast airings, GA4, and Amazon
spotlift run --spots schaltplan.csv --web ga4_minutes.parquet --out results.csv

# Solve constrained budget reallocation with diminishing returns
spotlift optimize --spots results.csv --budget 500000 --max-shift 0.35 --scenarios

# Export period-aligned MMM calibration data (PyMC, Meridian, Robyn)
spotlift mmm --spots results.csv --target all --out-dir ./mmm_export

# Generate BigQuery GA4 or Amazon Marketing Cloud (AMC) extraction SQL
spotlift sql --source ga4 --project my-gcp-project --dataset analytics_12345
spotlift sql --source amc --start 2026-03-01 --end 2026-03-21

# Authenticate SpotLift Pro license
spotlift auth --key SL_PRO_...

2. Command Details ​

spotlift demo ​

Executes an instant attribution pass on a synthetic benchmark campaign with zero external credentials or API keys required.

bash
spotlift demo --scenario dach --spots 600 --days 14 --out-dir ./demo_data
FlagTypeDefaultDescription
--scenario, -scStringdachScenario: dach (National + 36h AMC lag), amc (Omnichannel Clean Room), or us-state (Regional).
--spots, -sInteger600Number of TV broadcast airings to generate.
--days, -dInteger14Flight duration in days.
--out-dir, -oPath./demo_dataTarget directory to export benchmark CSVs and parquet files.

spotlift preflight / validate-inputs ​

Performs non-destructive validation of timestamps, UTC normalization, sample rate cadence, zero-gap detection, and collision severity before launching production attribution passes.

bash
spotlift preflight --spots tv_airings.csv --web ga4_minute_sessions.parquet --tz Europe/Berlin
FlagTypeDefaultDescription
--spots, -sPathRequiredPath to TV broadcast schedule (Schaltplan).
--web, -wPathRequiredPath to GA4 minute-level sessions.
--tz, -zStringUTCTimezone fallback if timestamps lack explicit offsets.
--windowInteger8Post-spot treatment window in minutes.
--jsonFlagfalseOutputs machine-readable JSON summary for AI coding agents.

spotlift run ​

Executes the high-frequency attribution engine across broadcast TV, web sessions, and Amazon sales.

bash
spotlift run \
  --spots /path/to/schaltplan.csv \
  --web /path/to/ga4_minutes.parquet \
  --amazon /path/to/amazon_hourly.csv \
  --format all \
  --out /path/to/attributed_spots.csv
FlagTypeDefaultDescription
--spots, -sPathRequiredPath to broadcast airings CSV or Parquet.
--web, -wPathRequiredPath to GA4 minute-level session CSV or Parquet.
--amazon, -aPathNoneOptional path to Amazon hourly telemetry CSV/Parquet.
--amc-conversionsPathNoneOptional path to AMC pre/post spot conversions CSV/Parquet.
--windowInteger8Post-spot response window in minutes.
--format, -fStringcsvExport format: csv, markdown, or all.
--out, -oPathNoneDestination path for attributed spots CSV.
--markdown-out, -mPathNoneDestination path for executive Markdown report.
--htmlPathNonePath to export interactive HTML report (SpotLift Pro).
--excelPathNonePath to export multi-tab agency Excel deck (SpotLift Pro).
--key, -kStringNoneSpotLift Pro license key (can also use SPOTLIFT_API_KEY).

spotlift optimize ​

Solves constrained budget reallocation using diminishing-returns response curves (R(s)=αsβ) and marginal CPIV (mCPIV) equalization.

bash
spotlift optimize \
  --spots /path/to/attributed_spots.csv \
  --budget 500000 \
  --max-shift 0.35 \
  --scenarios \
  --out /path/to/reallocated_budget.csv
FlagTypeDefaultDescription
--spots, -sPathRequiredPath to attributed spots CSV/Parquet (or raw airings if --web is provided).
--web, -wPathNoneOptional GA4 telemetry path if spots file is not yet attributed.
--mmmPathNoneOptional path to MMM posterior contributions CSV/Parquet/JSON (Direction 2: MMM → SpotLift Optimizer).
--mmm-adstockFloat0.0MMM geometric adstock retention λ∈[0,1) when --mmm is provided.
--risk-aversionFloat0.0Posterior uncertainty penalty weight (≥0) when --mmm is provided.
--outcome-overlapStringunknownOutcome provenance vs MMM: unknown, independent_stream, or shared_same_series.
--budget, -bFloatCurrent SpendTarget total budget (budget-neutral by default).
--max-shift, -mFloat0.35Maximum relative budget reallocation allowed per channel (±35%).
--elasticity, -eFloat0.70Diminishing returns elasticity parameter β (0<β<1).
--scenariosFlagfalseDisplays multi-scenario comparison (Conservative, Balanced, Aggressive).
--export-mmmPathNoneOptional directory to export pymc_causal_lower_bound.csv and pymc_lift_test.csv alongside recommendations.
--jsonFlagfalseOutputs machine-readable JSON summary for AI coding agents.
--out, -oPathNoneDestination path to export recommended budget CSV.

spotlift mmm ​

Exports causal lower-bound datasets (pymc_causal_lower_bound.csv), PyMC potential/latent-share adapters (pymc_lower_bound_model.py), provenance metadata (calibration_provenance.json), and support-matched priors for PyMC-Marketing, Google Meridian, and Meta Robyn.

bash
# Export PyMC causal lower-bound & potential snippet (weekly W-MON grain)
spotlift mmm --spots attributed_spots.csv --target lower-bound --out-dir ./mmm_export

# Export all frameworks with explicit latent-share PyMC adapter & finite-horizon carryover
spotlift mmm \
  --spots attributed_spots.csv \
  --target all \
  --freq W-MON \
  --pymc-mode latent_share \
  --adstock-retention 0.35 \
  --carryover-mode finite_horizon \
  --mmm-channel-name tv_broadcast \
  --out-dir ./mmm_export
FlagTypeDefaultDescription
--spots, -sPathRequiredPath to attributed spots CSV/Parquet (or raw airings if --web is provided).
--web, -wPathNoneOptional GA4 telemetry path if spots file is not yet attributed.
--target, -tStringpymcTarget MMM framework: pymc, lower-bound, meridian, robyn, or all.
--out-dir, -oPath./mmm_exportDestination folder for calibration files and prior specs.
--freq, -fStringW-MONMMM time period frequency (W-MON for weekly or D for daily).
--lift-col, -lStringincremental_liftLift metric (incremental_lift for sessions or key_event_response for conversions).
--adstock-retention, -aFloat0.0Optional adstock decay λ∈[0,1) (paired with --carryover-mode; default 0.0).
--carryover-modeStringnoneCarryover conversion mode: none (default causal floor), finite_horizon, or infinite_horizon.
--pymc-modeStringlower_boundPyMC snippet likelihood: lower_bound (asymmetric floor) or latent_share (learned ρ).
--outcome-overlapStringunknownOutcome provenance vs MMM: unknown, independent_stream, or shared_same_series.
--mmm-channel-nameStringNoneOptional unified TV media column name (e.g. tv_broadcast) to pool collinear stations.
--key, -kStringNoneSpotLift Pro key (for Meridian interchange YAML & Robyn calibration exports).
--jsonFlagfalseOutputs machine-readable JSON summary for CI/CD pipelines.

spotlift sql ​

Generates production-tested SQL templates for extracting digital telemetry from Google BigQuery or Amazon Marketing Cloud (AMC).

bash
# GA4 BigQuery SQL
spotlift sql --source ga4 --project my-gcp-project --dataset analytics_12345 --out ga4.sql

# AMC Athena SQL
spotlift sql --source amc --start 2026-03-01 --end 2026-03-21 --out amc.sql

spotlift auth ​

Authenticates and caches your SpotLift Pro license key with Polar.sh and activates compiled engine extensions.

bash
spotlift auth --key SL_PRO_...

Released under the MIT License.