パッケージの詳細

@dash0/sdk-web

dash0hq53.4kApache-2.00.18.0

Dash0's Web SDK to collect telemetry from end-users' web browsers

performance, observability, opentelemetry, otel

readme

Dash0 Web SDK

This SDK enables users of Dash0's web monitoring features to instrument a website or single-page-application to capture and transmit telemetry to Dash0.

Features include:

  • Page view instrumentation
  • Navigation timing instrumentation
  • HTTP request instrumentation
  • Error tracking

Getting started

Prerequisites

To setup the web sdk you'll need the following:

  1. Log in to your desired Dash0 account. You can sign up here

  2. Retrieve the following information from your Dash0 account:

    • endpoint URL for your Dash0 region (Dash0 link)

    • authToken with Ingesting permissions for the dataset (Dash0 link)

      • Auth tokens for client monitoring will be public as part of your website, please make sure to:
        • Use a separate token, exclusively for website monitoring; if you want to monitor multiple websites, it is best to use a dedicated token for each
        • Limit the dataset permissions on the auth token to the dataset you want to ingest Website Monitoring data with
        • Limit permissions on the auth token to Ingesting

Installation steps

  1. Add the SDK to your dependencies
# npm
npm install @dash0/sdk-web
# yarn
yarn add @dash0/sdk-web
# pnpm
pnpm install @dash0/sdk-web
  1. Initialize the SDK in your code: you'll need to call the init function at a convenient time in your applications lifecycle. Ideally this should happen as early as possible in the web page initialization, as most instrumentations shipped by the SDK can only observe events after init has been called.
import { init } from "@dash0/sdk-web";

init({
  serviceName: "my-website",
  endpoint: {
    // Replace this with the endpoint URL for your Dash0 region, that you retrieved earlier in "prerequisites"
    url: "{endpoint}",
    // Replace this with your auth token you retrieved earlier in "prerequisites"
    // Ideally, you will inject the value at build time in order not commit the token to git,
    // even if its effectively public in the HTML you ship to the end user's browser
    authToken: "{authToken}",
  },
});

For more detailed instructions, refer to INSTALL.md.

Development

See DEVELOPMENT.md for instructions on the development setup, testing and release process.

更新履歴

Changelog

0.17.0 (2025-11-12)

Features

  • unhandled-error: you can now pass additional attributes (#64) (088873b)

0.16.3 (2025-10-28)

Bug Fixes

0.16.2 (2025-10-14)

Bug Fixes

  • fetch: do not wrap body for responses that cant have a body (#59) (9b6b601)

0.16.1 (2025-10-10)

Bug Fixes

  • fetch: stop cloning responses and eagerly reading (#58) (1ab7bd3)

0.16.0 (2025-09-23)

Features

  • Add xray propagator and introduce propagator config (#54) (2012e7e)

0.15.0 (2025-09-05)

Features

  • remove rate limit on total event count (#53) (a0a24bf)

0.14.1 (2025-08-26)

Bug Fixes

  • add missing exports for utility types (#51) (7449306)

0.14.0 (2025-08-26)

Features

  • allow instrumentation selection and url scrubbing (#50) (17ccd4a)

0.13.5 (2025-08-25)

Bug Fixes

  • properly include missing type definitions (#49) (1eee7a2)

0.13.4 (2025-08-25)

Bug Fixes

  • prefix url attributes for current page (#47) (6a36700)

0.13.3 (2025-08-12)

0.13.2 (2025-07-29)

Bug Fixes

  • fetch instrumentation timing issues (#46) (0f06e09)

0.13.1 (2025-07-29)

0.13.0 (2025-07-24)

Features

  • send the "dash0.web.event.id" attribute (#44) (70e9b8e)

0.12.1 (2025-07-23)

0.12.0 (2025-07-18)

Features

0.11.2 (2025-07-18)

Bug Fixes

  • ignore attributes with empty keys (#41) (6e4f688)

0.11.1 (2025-07-17)

Bug Fixes

  • rename event title attribute to avoid conflicts (#40) (b2e219e)

0.11.0 (2025-07-16)

Features

  • adapt session-id, trace-id and traceparent header (#39) (c8479b0)

0.10.1 (2025-07-08)

Bug Fixes

0.10.0 (2025-07-04)

Features

0.6.1 (2025-06-26)

Bug Fixes

  • set sampled bit in traceparent header (ec78007)

0.6.0 (2025-06-26)

Features

0.5.5 (2025-06-26)

Bug Fixes

  • use correct parentid in traceparent header (775842d)

0.5.4 (2025-06-25)

0.5.3 (2025-06-13)

Bug Fixes

  • use session storage for tab tracking (#27) (86ec6d4)

0.5.2 (2025-06-13)

Bug Fixes

  • include event name attribute in error events (#26) (d6b9c07)

0.5.1 (2025-06-10)

Bug Fixes

0.5.0 (2025-06-06)

Features

0.4.6 (2025-06-06)

0.4.5 (2025-06-05)

0.4.4 (2025-06-04)

Bug Fixes

  • dont attempt to call global timer functions if undefined (#21) (b643683)

0.4.3 (2025-05-30)

Bug Fixes

0.4.2 (2025-05-30)

Bug Fixes

  • dont make users create otel type objects for events (#19) (5d3b8c0)

0.4.1 (2025-05-30)

Bug Fixes

  • expose send event api for module build (#18) (20a7c23)

0.4.0 (2025-05-30)

Features

0.3.4 (2025-05-27)

Bug Fixes

  • support all user attributes on identify (#16) (e8e8e7d)

0.3.3 (2025-05-27)

Bug Fixes

  • sdk: Added compat helper to detect support for stacktraces in exceptions (770c8e7)
  • sdk: Removed fragment assertion from tests (db71703)

0.3.2 (2025-05-22)

0.3.1 (2025-05-21)

Bug Fixes

  • properly support array attributes (#14) (61cf57b)

0.3.0 (2025-05-20)

Features

0.2.0 (2025-05-20)

Features

0.1.3 (2025-05-20)

Bug Fixes

0.1.2 (2025-05-13)

Bug Fixes

  • types export to point to the correct file (#9) (faa766b)

0.1.1 (2025-05-06)

Bug Fixes

  • clarify traceparent header value and set right trace flags (#8) (c5ef4da)

0.1.0 (2025-05-05)

Features

0.0.8 (2025-04-30)

Bug Fixes

  • small attribute improvements (#6) (21061b4)

0.0.7 (2025-04-29)

Bug Fixes

  • semantic-conventions: update attribute key to align with the network semantic conventions (c368b38)

0.0.6 (2025-04-24)

Bug Fixes

0.0.5 (2025-04-23)

Bug Fixes

  • avoid double init calls and dont explode on unexpected event handler conditions (97c2fff)
  • lazy init rate limiter (0425068)

0.0.4 (2025-04-23)

Bug Fixes

  • caught another unprotected use of window (7a73416)
  • gracefully handle being imported in ssr context (048785e)

0.0.2 (2025-04-23)