---
title: Browser Error Tracking
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > Log Management > Error Tracking for Logs > Browser Error Tracking
---

# Browser Error Tracking

## Overview{% #overview %}

Error Tracking processes errors collected from browser and mobile Datadog Log SDKs. Whenever an error containing a stack trace is collected, Error Tracking processes and groups it under an *issue*, which is a grouping of similar errors.

An essential attribute for log errors is the stack trace in a log's `error.stack`. If you are sending stack traces to Datadog but they are not in `error.stack`, you can set up a [generic log remapper](https://docs.datadoghq.com/logs/log_configuration/processors/?tab=ui#remapper) to remap the stack trace to the correct attribute in Datadog.

Your crash reports appear in [**Error Tracking**](https://app.datadoghq.com/logs/error-tracking).

## Setup{% #setup %}

{% tab title="Browser" %}
If you have not set up the Datadog Browser Logs SDK yet, follow the [in-app setup instructions](https://app.datadoghq.com/logs/onboarding/client) or see the [Browser Logs setup documentation](https://docs.datadoghq.com/logs/log_collection/javascript/#setup).

1. Download the latest version of the Logs Browser SDK. Error Tracking requires at least `v4.36.0`.

1. Configure your application's `version`, `env`, and `service` when [initializing the SDK](https://docs.datadoghq.com/logs/log_collection/javascript/#choose-the-right-installation-method). For example, with NPM:

   ```javascript
   import { datadogLogs } from '@datadog/browser-logs'
   
   datadogLogs.init({
     clientToken: '<DATADOG_CLIENT_TOKEN>',
     site: '<DATADOG_SITE>',
     service: '<MY_SERVICE>',
     env: '<MY_ENV>',
     forwardErrorsToLogs: true,
     sessionSampleRate: 100,
   })
   ```

1. To log a caught exception yourself, you may use [the optional error parameter](https://docs.datadoghq.com/logs/log_collection/javascript/#error-tracking):

   ```javascript
   try {
     throw new Error('wrong behavior');
   } catch(err) {
     datadogLogs.logger.error("an error occurred", {usr: {id: 123}}, err);
   }
   ```

**Note**: Error Tracking only considers errors that are instances of `Error`.
{% /tab %}

{% tab title="Android" %}
If you have not set up the Datadog Android Logs SDK yet, follow the [in-app setup instructions](https://app.datadoghq.com/logs/onboarding/client) or see the [Android Logs setup documentation](https://docs.datadoghq.com/logs/log_collection/android/#setup).

1. Download the latest version of the [Datadog Android SDK for Logs](https://github.com/Datadog/dd-sdk-android).

1. Configure your application's `version`, `env`, and `service` when [initializing the SDK](https://docs.datadoghq.com/logs/log_collection/android/?tab=kotlin#setup).

1. To log a caught exception yourself, you may optionally use:

   ```kotlin
   try {
     doSomething()
   } catch (e: IOException) {
     logger.e("an exception occurred", e)
   }
   ```

{% /tab %}

{% tab title="iOS" %}
If you have not setup the Datadog iOS Logs SDK yet, follow the [in-app setup instructions](https://app.datadoghq.com/logs/onboarding/client) or see the [iOS Logs setup documentation](https://docs.datadoghq.com/logs/log_collection/ios/#setup).

1. Download the latest version of the [Datadog iOS SDK for Logs](https://github.com/Datadog/dd-sdk-ios).

1. Configure your application's `version`, `env`, and `service` when [initializing the SDK](https://docs.datadoghq.com/logs/log_collection/ios/?tab=cocoapods#setup).

1. To log a caught exception yourself, you may optionally use:

   ```swift
   do {
     // ...
   } catch {
     logger.error("an exception occurred", error)
   }
   ```

{% /tab %}

{% tab title="Kotlin Multiplatform" %}
If you have not setup the Datadog Kotlin Multiplatform Logs SDK yet, follow the [in-app setup instructions](https://app.datadoghq.com/logs/onboarding/client) or see the [Kotlin Multiplatform Logs setup documentation](https://docs.datadoghq.com/logs/log_collection/kotlin_multiplatform/#setup).

1. Download the latest version of the [Datadog Kotlin Multiplatform SDK for Logs](https://github.com/Datadog/dd-sdk-kotlin-multiplatform).

1. Configure your application's `version`, `env`, and `service` when [initializing the SDK](https://docs.datadoghq.com/logs/log_collection/kotlin_multiplatform/#setup).

1. To log a caught exception yourself, you may optionally use:

   ```kotlin
   try {
     doSomething()
   } catch (e: IOException) {
     logger.error("an exception occurred", e)
   }
   ```

{% /tab %}

## Further Reading{% #further-reading %}

- [Make sense of application issues with Datadog Error Tracking](https://www.datadoghq.com/blog/error-tracking/)
- [Learn about the Error Tracking Explorer](https://docs.datadoghq.com/logs/error_tracking/explorer/)
