# croct

Learn how to run a snippet once the client-side SDK is ready.

This Twig filter defers a snippet until the client-side SDK has loaded, then runs it with the [`croct`](/reference/sdk/javascript/api/plug) instance available, regardless of the loading [mode](/reference/sdk/symfony/api/configuration#script-prop).

## Signature

Apply the filter to a block of JavaScript:

```twig
{% apply croct %}
    // your JavaScript using the croct instance
{% endapply %}
```

## Example

Here is a basic example of how to use this filter, passing server-side values into the snippet with Twig:

**templates/checkout/confirmation.html.twig**

```twig
{% apply croct %}
    croct.track('orderPlaced', {
        order: {
            orderId: {{ order.id|json_encode|raw }},
            total: {{ order.total|json_encode|raw }},
        },
    });
{% endapply %}
```
