# Feature Experimentation

The **Resource Loader** for **Feature Experimentation** organizes data in a shallow, human-readable JSON tree. The nesting is intentionally limited to **Project → Campaign → Variation Group → Variation** (with optional **Modifications/Flags** on each Variation). This mirrors how feature tests are designed and run: you define a project, create a campaign (experiment/rollout), split traffic within **variation groups**, and optionally attach **feature flag / config modifications** to non-reference variations. Uncommon or rarely used properties are simplified or omitted to keep the schema compact and version-controlled.

* **Campaign:** An AB Test, feature experiment or rollout. Defines name, type (e.g., `ab`), and one or more **variation\_groups**. Each campaign belongs to exactly one project.
* **Variation group**: A traffic split within a campaign (e.g., a single test with Original vs Variation). Each group holds:
  * The **variations** with their traffic **allocation** and a single **reference** (“original”) variation.
  * Optional **targeting** rules (key/value conditions) that gate which users enter the group, it's\
    an optional audience rules at the variation-group level. Each group can define one or more **targeting\_groups**, each containing **targetings** (AND within a group). Every targeting has a `key`, `operator`, and `value` (e.g., `release EQUALS v1.0.0`)..
* **Variation:** A variation is an alternate version within a campaign. For an A/B test, the variations could be the control (original) and one or more test versions. Each variation can have associated modifications that implement the changes for that version of the campaign. each Non-reference variation carries a modification. It's the feature changes applied for a variation. Typical type is `FLAG` — set one or more flag keys to specific values (e.g., string/boolean/number).

In addition, the resource loader supports organizational and targeting resources:

* **Project :** A project is used to organize campaigns into groups.
* **Goal:** A conversion/analytics objective definition (e.g., screen view, event name match). Typically referenced by your analytics layer and/or associated with campaigns for reporting.
* **Targeting key**: Declares a key you can use in `targeting` (e.g., `release`, `country`, or a custom key your SDK populates). Helps keep targeting keys governed and documented.
* **Flag**: A feature flag (name, type, description, source). Variations set flag values via **modifications**.

Each resource type (Campaign, Variation group, Variation, Project, Goal, Targeting key, Flag) is defined with its own schema, including its fields, nested structure, and relationships. Below, we document each resource in detail with high-level explanations, field definitions, example payloads, and example responses.

Resource Loader file example:

```json
{
    "version": 1,
    "resources": [
        {
            "type": "project",
            "$_ref": "p1",
            "action": "create",
            "payload": {
                "name": "Resource loader Project"
            }
        },
        {
            "type": "campaign",
            "$_ref": "c1",
            "action": "create",
            "payload": {
                "project_id": "$p1.id",
                "name": "Resource loader Campaign - with targeting & existing flag",
                "description": "Loaded from resource loader",
                "type": "ab",
                "variation_groups": [
                    {
                        "name": "variation group name",
                        "variations": [
                            {
                                "name": "Original",
                                "reference": true,
                                "allocation": 50
                            },
                            {
                                "name": "Variation 1",
                                "reference": false,
                                "allocation": 50,
                                "modifications": {
                                    "type": "FLAG",
                                    "value": {
                                        "eai-flag": "blue"
                                    }
                                }
                            }
                        ],
                        "targeting": {
                            "targeting_groups": [
                                {
                                    "targetings": [
                                        {
                                            "operator": "EQUALS",
                                            "key": "release",
                                            "value": "v1.0.0"
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "type": "flag",
            "action": "create",
            "$_ref": "f1",
            "payload": {
                "name": "flag_created_with_resource_loader",
                "type": "string",
                "description": "Loaded from resource loader",
                "source": "manual"
            }
        },
        {
            "type": "goal",
            "action": "create",
            "$_ref": "g1",
            "payload": {
                "type": "screenview",
                "label": "goal_created_with_resource_loader",
                "operator": "contains",
                "value": "Performance"
            }
        },
        {
            "type": "targeting-key",
            "action": "create",
            "$_ref": "t1",
            "payload": {
                "type": "string",
                "name": "targeting_key_created_with_resource_loader",
                "description": "Loaded from resource loader"
            }
        }
    ]
}
```


---

# 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.abtasty.com/server-side/command-line-interface/resource-loader/feature-experimentation.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.
