---
title: "LongTasks"
description: "Capture long animation frames and long tasks that block the main thread as browser spans."
url: https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/integrations/longtasks/
---

# LongTasks for SvelteKit

This integration only works inside a browser environment. It requires JavaScript SDK version 11.14.0 or later.

*Import name: `Sentry.longTasksIntegration`*

The LongTasks integration captures long animation frames as spans on the active span. In browsers that do not support long animation frames, it captures long tasks (main thread blocking for more than 50ms) instead.

The [BrowserTracing](https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/integrations/browsertracing.md) integration adds this integration automatically, so you don't need to add it yourself. Configure it through BrowserTracing's `enableLongTask` and `enableLongAnimationFrame` options. Set both to `false` to turn it off.

```javascript
Sentry.init({
  integrations: [
    Sentry.browserTracingIntegration({
      enableLongAnimationFrame: false,
    }),
  ],
});
```

To set its options directly, add the integration yourself. An explicitly added LongTasks integration takes precedence over BrowserTracing's settings.

## [Configuration Options](https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/integrations/longtasks.md#configuration-options)

### [enableLongAnimationFrame](https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/integrations/longtasks.md#enableLongAnimationFrame)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Capture long animation frames as spans in browsers that support them.

### [enableLongTask](https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/integrations/longtasks.md#enableLongTask)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Capture long tasks as spans when long animation frames are disabled or not supported.

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
