> Part of the walkerOS documentation. Project overview and full index: <https://www.walkeros.io/llms.txt>

# Plausible Analytics

<!-- -->

[Web](#)[ ](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/plausible)

<!-- -->

[Source code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/plausible)[ ](https://www.npmjs.com/package/@walkeros/web-destination-plausible)

<!-- -->

[Package](https://www.npmjs.com/package/@walkeros/web-destination-plausible)

[Plausible Analytics](https://plausible.io/) is a simple, privacy-friendly Google Analytics alternative. The destination loads the Plausible script, initializes the `plausible` function, and sends page views and custom events.

<!-- -->

Where this fits

Plausible is a **web destination** in the walkerOS flow:

## Installation[​](#installation "Direct link to Installation")

```
npm install @walkeros/web-destination-plausible
```

* Integrated
* Bundled

```
import { startFlow } from '@walkeros/collector';
import { destinationPlausible } from '@walkeros/web-destination-plausible';

await startFlow({
  destinations: {
    plausible: {
      code: destinationPlausible,
      config: {
        settings: {
          domain: 'walkeros.io',
        },
      },
    },
  },
});
```

Add to your `flow.json` destinations:

```
"destinations": {
  "plausible": {
    "package": "@walkeros/web-destination-plausible",
    "config": {
      "settings": {
        "domain": "walkeros.io"
      }
    }
  }
}
```

[See bundled mode setup](https://www.walkeros.io/docs/getting-started/modes/bundled.md) | [CLI reference](https://www.walkeros.io/docs/apps/cli.md)

## Configuration[​](#configuration "Direct link to Configuration")

This <!-- -->destination<!-- --> uses the standard <!-- -->destination<!-- --> config wrapper (consent, data, env, id, ...). For the shared fields see [destination<!-- --> configuration](https://www.walkeros.io/docs/destinations.md#configuration). Package-specific fields live under `config.settings` and are listed below.

## Settings[​](#settings "Direct link to Settings")

| Property | Type     | Description                                        | More |
| -------- | -------- | -------------------------------------------------- | ---- |
| `domain` | `string` | The domain of your site as registered in Plausible |      |

## Mapping[​](#mapping "Direct link to Mapping")

This package does not define custom rule-level settings. For the standard rule fields (consent, condition, data, batch, name, policy) see [mapping](https://www.walkeros.io/docs/mapping.md).

## Examples

### Custom event

A generic entity action fires a Plausible custom event with mapped props and a revenue field.

Event

```
{
  "name": "entity action",
  "data": {
    "string": "foo",
    "number": 1,
    "boolean": true,
    "array": [
      0,
      "text",
      false
    ]
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "e7d6e5e66da04117",
  "trigger": "test",
  "entity": "entity",
  "action": "action",
  "timestamp": 1700000201,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "collector",
    "schema": "4"
  }
}
```

Mapping

```
{
  "name": "Custom Event",
  "data": {
    "map": {
      "props": "data",
      "revenue": "data.number"
    }
  }
}
```

Out

```
plausible("Custom Event", {
  "props": {
    "string": "foo",
    "number": 1,
    "boolean": true,
    "array": [
      0,
      "text",
      false
    ]
  },
  "revenue": 1
})
```

### Initialization

Destination bootstrap loads the Plausible script for the configured domain and installs the queue.

Event

```
{
  "loadScript": true,
  "settings": {
    "domain": "example.com"
  }
}
```

Out

```
script.appendChild({
  "src": "https://plausible.io/js/script.manual.js",
  "domain": "example.com"
})
```

### Purchase

A completed order fires a Plausible purchase event with revenue currency and amount.

Event

```
{
  "name": "order complete",
  "data": {
    "id": "0rd3r1d",
    "currency": "EUR",
    "shipping": 5.22,
    "taxes": 73.76,
    "total": 555
  },
  "context": {
    "shopping": [
      "complete",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "product",
      "data": {
        "id": "ers",
        "name": "Everyday Ruck Snack",
        "color": "black",
        "size": "l",
        "price": 420
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    },
    {
      "entity": "product",
      "data": {
        "id": "cc",
        "name": "Cool Cap",
        "size": "one size",
        "price": 42
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    },
    {
      "entity": "gift",
      "data": {
        "name": "Surprise"
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f9db001e8d027b6d",
  "trigger": "load",
  "entity": "order",
  "action": "complete",
  "timestamp": 1700000200,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "collector",
    "schema": "4"
  }
}
```

Mapping

```
{
  "name": "purchase",
  "data": {
    "map": {
      "revenue": {
        "map": {
          "currency": {
            "value": "EUR"
          },
          "amount": "data.total"
        }
      }
    }
  }
}
```

Out

```
plausible("purchase", {
  "revenue": {
    "currency": "EUR",
    "amount": 555
  }
})
```
