gatsby-plugin-datadog

Gatsby plugin to add Datadog logging and real user monitoring (RUM) to your site.

Learn more about Datadog here.

Install

npm install --save gatsby-plugin-datadog

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: "gatsby-plugin-datadog",
    options: {
      logs: {
        clientToken: '[YOUR_CLIENT_TOKEN]',
        site: 'datadoghq.com',
        sampleRate: 100,
        enabled: !IS_DEV,
      }
    }
  }
];

Options available are same as the Datadog initialization parameters. Additionally, the parameter enabled (boolean) is available to easily turn the plugin integration on/off.

Now datadogLogs is available on the global window object, so you can use it like this:

datadogLogs.logger.info("Hello World!");