# Overview

EdgeTag ships with dozens of pre-built channels (Meta CAPI, Google Ads, Klaviyo, TikTok, and many more) that cover the destinations most customers need. But sooner or later, you run into something that isn't in the catalog — an in-house analytics tool you want to forward events to, a bespoke identity stitching rule, a per-channel payload tweak, a first-party API endpoint you want to expose on your own domain, or a nightly export to your warehouse.

Playground is for exactly those cases. It lets you write the same kind of code our built-in channels run — on the EdgeTag edge (Cloudflare Workers) and in the browser — without leaving the UI. An AI agent turns natural-language prompts into code, a simulation runtime replays sample events through your code before you deploy, and saves your changes, publishing them instantly to your own EdgeTag infrastructure.

{% embed url="<https://www.loom.com/share/a745bc0e27a348bc8644fc6eb03d20f9>" %}

### Two options

Playground has two options. Pick based on what you're trying to do.

{% columns %}
{% column %}
**Destination** — build a new integration from scratch. Send events to a third-party API, expose a custom first-party endpoint on your domain, persist data in your own D1 database, and run a cron job. Destination gives you HTTP requests, identity-graph access, infrastructure bindings, and scheduled tasks.

{% content-ref url="/pages/a22b22dc8123e5cc91be423b8232290063eb9190" %}
[Destination](/playground/destination.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
**Transformation** — reshape the events already flowing through your existing channels. Drop events you don't want to forward, enrich payloads with extra fields, rename events conditionally, or fan out additional events. Transformations run as a plugin before every channel and are pure event transforms — no HTTP, no storage.

{% content-ref url="/pages/199d549a34fa566156bf3035540ff0cb79382594" %}
[Transformation](/playground/transformation.md)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}

{% hint style="info" %}
Rule of thumb: if you're creating a **new** endpoint or integration, use a Destination. If you're modifying events going to **existing** channels, use a Transformation.
{% endhint %}

### What you can build

A few things customers have built with Playground:

* A custom pixel for an in-house attribution tool
* A warehouse webhook that mirrors every Purchase into BigQuery via a forwarding service
* Cross-domain ID stitching that reads a cookie on one domain and writes it on another
* A SHA-256 PII hashing policy is applied uniformly across every outgoing event
* Dropping `PageView` events from going to paid-media channels, while keeping them in analytics
* Conditional event fan-out (e.g., emit `Purchase_Facebook` when the user's last paid-media click was on Facebook)
* A first-party `/api/subscribe` endpoint backed by D1
* A nightly export that dumps yesterday's events to R2 as CSV

### How it works

Playground is a chat-based code environment. The typical flow:

{% stepper %}
{% step %}

### Describe what you want

Tell the agent in plain English what the integration should do. It generates the code for the relevant files and explains the choices it made.
{% endstep %}

{% step %}

### Edit in the code editor

Every file is editable directly; the agent's output is a starting point, not a lock-in.
{% endstep %}

{% step %}

### Simulate

Pick a sample event (`Purchase`, `PageView`, `AddToCart`) and run your code in an isolated sandbox. Every HTTP request, log line, and return value is captured so you can verify the behavior before anything reaches production.
{% endstep %}

{% step %}

### Save

Once you're happy, saving deploys your code to your EdgeTag edge. There is no separate publish step.
{% endstep %}
{% endstepper %}

<figure><img src="/files/tFoEo5lC6ftWNWPY8Ltv" alt="Playground chat, code editor, and simulation output"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.edgetag.io/playground/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
