> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchski-attract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List the enabled Conversions

> Every enabled Conversion, compiled: its key, the platforms it sends to and how (from the page, the server or both — never the platforms’ own IDs), and what triggers it (counts only — never the forms, pages or links themselves).

```php Laravel wrap theme={"dark"}
use Fetchski\AttractCmsLaravel\Facades\Attract;

$listConversionDefinitions = Attract::conversions()->listConversionDefinitions();
```

```json 200 wrap theme={"dark"}
{
  "conversions": [
    {
      "id": "ckq1w2e3r4t5y6u7i8o9p0",
      "key": "booking",
      "title": "Booking",
      "currency": "USD",
      "counting": "every",
      "destinations": [
        "google-ads",
        "meta",
        "tiktok"
      ],
      "platforms": {
        "google-ads": {
          "browser": true,
          "server": true
        },
        "meta": {
          "browser": true,
          "server": true
        },
        "tiktok": {
          "browser": false,
          "server": true
        }
      },
      "sendUserData": true,
      "triggers": {
        "forms": 0,
        "pageViews": 0,
        "links": 0,
        "outbound": false,
        "downloads": 0,
        "chat": [],
        "external": true
      }
    }
  ]
}
```

## In your app

A controller answers a route on your app: it calls `listConversionDefinitions()` and returns the answer.

**1. Add the controller**

```php app/Http/Controllers/ListConversionDefinitionsController.php theme={"dark"}
<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use Fetchski\AttractCmsLaravel\Data\ListConversionDefinitionsResponse;
use Fetchski\AttractCmsLaravel\Facades\Attract;

final class ListConversionDefinitionsController
{
    public function __invoke(): ListConversionDefinitionsResponse
    {
        return Attract::conversions()->listConversionDefinitions();
    }
}
```

**2. Add the route**

```php routes/web.php theme={"dark"}
use App\Http\Controllers\ListConversionDefinitionsController;
use Illuminate\Support\Facades\Route;

Route::get('/conversion/definitions', ListConversionDefinitionsController::class);
```

**3. Call it**

```bash Terminal theme={"dark"}
curl http://localhost:8000/conversion/definitions
```

With `php artisan serve` running, it prints its answer as JSON.

> [!TIP]
>
> To keep the call in an Action instead, this writes `app/Actions/Attract/ListConversionDefinitions.php` (an invokable Action that calls `listConversionDefinitions()`) and its test under `tests/Feature/Actions/Attract/` (Pest when your app has it):
>
> ```bash Terminal theme={"dark"}
> php artisan make:attract-action conversions.listConversionDefinitions
> ```

## Call it from the terminal

```bash Terminal theme={"dark"}
php artisan attract:call conversions.listConversionDefinitions
```

It calls `listConversionDefinitions()` on your default site and prints its answer as JSON. See [Call any method from the terminal](https://docs.fetchski-attract.com/call-command.md) for every argument type.

Another system uses it to find the Conversion to post facts to: `triggers.external: true` accepts `POST /conversion-event/external`, naming the Conversion by its `id` or `key`.

> [accordion] Parameters
>
> None: call it with no arguments.

> [accordion] Returns
>
> A `ListConversionDefinitionsResponse` (`Fetchski\AttractCmsLaravel\Data\ListConversionDefinitionsResponse`). The enabled Conversions. Read its properties (`$listConversionDefinitions->conversions`): each says whether the site always sends it.
>
> **conversions** `Collection\<int, ConversionDefinition\>`
>
> **Always sent.** A list of `ConversionDefinition`.
>
> **ConversionDefinition (Fetchski\AttractCmsLaravel\Data\ConversionDefinition)**
>
> **id** `string`
>
> **Always sent.**
>
> **key** `string`
>
> **Always sent.** The Conversion’s neutral name (its key in the CMS): what the Data API, webhooks and the events list carry, and what Google Analytics and Tag Manager receive as `conversion_key`. Matches `^[a-z0-9]+(?:-[a-z0-9]+)*$`.
>
> **currency** `string`
>
> **Always sent.** Matches `^[A-Z]{3}$`.
>
> **counting** `Enums\\Counting|string`
>
> **Always sent.** One of `once`, `every`; a newer site may send others, so keep a fallback.
>
> **destinations** `Collection\<int, Enums\\Destinations|string\>`
>
> **Always sent.** The platforms it sends to (its switched-on rows). Each one of `google-ads`, `ga4`, `gtm`, `meta`, `tiktok`.
>
> **platforms** `array\<string, ConversionDefinitionPlatformsValue\>`
>
> **Always sent.** A map of names to `ConversionDefinitionPlatformsValue`. Per platform in `destinations`: whether the page’s tag sends it, the server, or both.
>
> **ConversionDefinitionPlatformsValue (Fetchski\AttractCmsLaravel\Data\ConversionDefinitionPlatformsValue)**
>
> **browser** `bool`
>
> **Always sent.**
>
> **server** `bool`
>
> **Always sent.**
>
> **sendUserData** `bool`
>
> **Always sent.**
>
> **triggers** `ConversionDefinitionTriggers`
>
> **Always sent.** A `ConversionDefinitionTriggers`.
>
> **ConversionDefinitionTriggers (Fetchski\AttractCmsLaravel\Data\ConversionDefinitionTriggers)**
>
> Required.
>
> **forms** `int`
>
> **Always sent.** How many forms fire it. At least 0.
>
> **pageViews** `int`
>
> **Always sent.** At least 0.
>
> **links** `int`
>
> **Always sent.** How many link rules fire it (phone, email, text, directions, listed websites, written patterns). At least 0.
>
> **outbound** `bool`
>
> **Always sent.** Fires on any link that leaves the site.
>
> **downloads** `int`
>
> **Always sent.** How many file types fire it when downloaded. At least 0.
>
> **chat** `Collection\<int, string\>`
>
> **Always sent.**
>
> **external** `bool`
>
> **Always sent.** Accepts facts posted to `POST /conversion-event/external`.
>
> **title** `?string`
>
> **Sometimes sent:** `null` when the site leaves it out.
>
> **value** `?float`
>
> **Sometimes sent:** `null` when the site leaves it out. At least 0.

> [accordion] Errors
>
> Nothing to catch: the SDK retries what is safe, and Laravel logs and renders the rest (see [Errors and testing](https://docs.fetchski-attract.com/laravel/errors.md)).
>
> **AuthenticationFailed** `401`
>
> The API key is missing, malformed, unknown, disabled, expired or archived (`invalid`), or a request that must be signed — by the route, or by the key’s own signing mode — has a missing, stale or wrong signature (an upload signs its SHA-256, declared in `X-Fetchski-Content-SHA256`, in the body’s place) (`unauthorized`).
>
> **Retried first:** No. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **Forbidden** `403`
>
> The API key lacks the scope this route needs (the message names it), or the key is used from an address outside its allowlist.
>
> **Retried first:** No. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **NotFound** `404`
>
> Nothing with this identifier — or the caller may not use the Data API at all (anonymous visitors and non-admin sessions get 404 so the API is not advertised). A write while conversion tracking is switched off also answers 404.
>
> **Retried first:** No. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **RateLimited** `429`
>
> The key used up its reads- or writes-per-minute limit (set per key; defaults 600 / 120). Still, after the client’s own waits and retries.
>
> **Retried first:** Yes: the client waits `Retry-After` (1 s when absent; over 60 s it gives up at once) and retries, up to `retries` times (2 by default). **Read:** `retryAfter()` (seconds, or null), `siteMessage()`.
>
> **SiteError** `5xx`
>
> The site failed (or something in front of it did). Its logs say why.
>
> **Retried first:** A 502, 503 or 504: yes, after 0.5 s then 1 s. A 500: no. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **SiteUnreachable** `no answer`
>
> No answer: DNS, a refused connection, TLS, or the timeout (15 s per attempt by default).
>
> **Retried first:** Yes, after 0.5 s then 1 s. **Read:** `reason()`, `neverConnected()`.
>
> **RequestNotSent** `not sent`
>
> The client refused to send it (e.g. a path segment of `..`); the site never saw it.
>
> **Retried first:** No. **Read:** `reason()` (what to change).
>
> **SiteRequestFailed** `any other`
>
> Any other status, or a success whose JSON doesn’t match this SDK version’s types (update the SDK).
>
> **Retried first:** No. **Read:** `reason()`, `status()`.
>
> **UnknownSite** `setup`
>
> `Attract::site('acme')` named a slug that isn’t under `sites` in `config/fetchski-attract.php`.
>
> **Retried first:** No: nothing was sent. **Read:** `getMessage()`, `$e->slug`.
>
> **SiteConfigurationError** `setup`
>
> The site’s config entry is wrong: no `url`, a malformed `api_key`, a key filed under another slug, or no default site.
>
> **Retried first:** No: nothing was sent. **Read:** `getMessage()` (what to fix).

## Behavior

* **Access:** an API key with `conversions:read` — or its group master `ads:all`, or `admin:all` — or a signed-in user holding the `conversion-events:view` permission. Anonymous callers get 404.
* **Rate limit:** the key’s own reads-per-minute limit, set when the key is created (default 600); over it, 429 with `Retry-After`. The client waits and retries for you; you see `RateLimited` only if that runs out.
* **Retries:** a read is safe to repeat: the client retries it on no answer, a 502/503/504 and a 429.
* **Timeout:** 15 s per attempt by default; raise `timeout` in `config/fetchski-attract.php` for longer.

## Test it

It calls the route above with the SDK faked: the fake answers every call with a valid example, so nothing leaves your machine and no config or key is needed. Save it as `tests/Feature/ListConversionDefinitionsTest.php`, then run your tests:

```php tests/Feature/ListConversionDefinitionsTest.php theme={"dark"}
<?php

declare(strict_types=1);

namespace Tests\Feature;

use Fetchski\AttractCmsLaravel\Facades\Attract;
use Tests\TestCase;

final class ListConversionDefinitionsTest extends TestCase
{
    public function test_list_conversion_definitions(): void
    {
        Attract::fake();

        $this->getJson('/conversion/definitions')->assertOk();

        Attract::assertCalled('conversions.listConversionDefinitions');
    }
}
```

```bash Terminal theme={"dark"}
php artisan test
```

## Related

> [card] [Conversions the page can fire (public)](https://docs.fetchski-attract.com/laravel/reference/conversions/list-active-conversions.md)
>
> `Attract::conversions()->listActiveConversions()`

> [card] [GET /conversion/definitions](https://docs.fetchski-attract.com/api-reference/conversions/list-the-enabled-conversions.md)
>
> The endpoint this calls, in the API reference: the HTTP request and answer, and every rule the site checks.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.