Simulation

Simulation runs your Destination code in an isolated sandbox against a realistic sample event, captures every side effect, and shows you the result — without anything reaching production. Use it after every change before you save.

What gets run

When you click Simulate, Playground:

  1. Takes the current code from every stage file

  2. Injects your Variables as params.secrets

  3. Mocks every Infrastructure binding in memory

  4. Runs the file you selected (default is edge/tag) against the current sample event

  5. Captures all HTTP requests, logs, and any thrown errors

Nothing leaves the sandbox. No real API calls are made, no rows are written to your D1 database, no files are uploaded to R2.

Sample events

Every session starts with three pre-populated sample events you can switch between:

  • Purchase — a full purchase with two line items, a value, an order ID, and user PII.

  • PageView — a page view with a name and category.

  • AddToCart — a single-item add-to-cart with a value and currency.

You change the sample event from the UI (click on View/Edit Input); the rest of the params object (user, host data, provider data, custom data) stays the same across events.

What you see

The simulation output has three sections:

  • Captured requests — every call your code made through params.requestHandler. Shows URL, method, headers, and body for each request.

  • Logs — everything you wrote with params.logger.log(...) or params.logger.error(...).

  • Error — if your code threw, the error message and stack.

Sensitive values are redacted automatically: any header or body key matching authorization, token, api-key, api_key, secret, password, or cookie is replaced with [REDACTED] before it's shown.

A complete worked example

Say you're writing a Destination that forwards Purchase events to a third-party conversions API with a SHA-256-hashed email and a Bearer token from Variables. After you simulate against the Purchase sample event, the output will look roughly like this:

From that output, you can verify your code is:

  • Hitting the right URL with the right method

  • Passing the right headers (your Bearer token is present, even though it's redacted in the display)

  • Sending the right body fields, in the right shape

  • Logging what you expected

If anything is off — wrong URL, missing field, a null value you didn't expect — you fix it in the editor and simulate again. No deploy, no rollback, no risk.

circle-info

Simulate after every meaningful change. It's the fastest way to catch issues before they hit production, and it's the only way to see exactly what your third-party APIs will receive.

Last updated

Was this helpful?