RUM community plugins

A personal community project under @kyletaylored, MIT licensed.Not provided or supported by Datadog.

Getting started

Three steps: get RUM running, add a plugin to the init you already have, then confirm the events arrive. Budget an hour, most of which is waiting for a real order to come through.

Before installing anything, the sandbox runs these adapters against recorded platform payloads in your browser and shows every RUM call they make. It is the quickest way to see what a plugin will and will not send.

1. Add RUM

If RUM is already on the site, skip this. These plugins never call init themselves, so your application ID, sampling and privacy settings stay in charge. Follow Datadog's ownbrowser setup first and confirm sessions appear before adding a plugin.

2. Add a plugin

Put consent adapters first in plugins: [...]. A consent adapter setstrackingConsent = 'not-granted' before the SDK starts, so nothing is collected on a page where the banner has not been answered.

import { datadogRum } from '@datadog/browser-rum'
import { oneTrustPlugin } from '@kyletaylored/datadog-rum-plugin-onetrust'
import { wooCommercePlugin } from '@kyletaylored/datadog-rum-plugin-woocommerce'

datadogRum.init({
  applicationId, clientToken, site, service, env, version,
  plugins: [
    oneTrustPlugin({ category: 'C0002' }), // holds RUM until analytics is accepted
    wooCommercePlugin({ identifyUsers: true, includeItems: false }),
  ],
})

On Shopify checkout the community adapter composes with the official one rather than replacing it. Both read the same sandbox analytics global, and they subscribe to different events, so there is no overlap.

// Settings > Customer events > custom pixel
DD_RUM.init({
  /* ... */
  plugins: [
    DD_RUM.shopifyPlugin({ shopifyAnalytics: analytics }), // official: sandbox fixes, views, clicks, errors
    DD_RUM_PLUGINS['shopify']({ analytics }),              // community: checkout events, order value, setUser
  ],
})

3. Check the events

  1. Turn on debug: true and reload. Every mapped event prints to the console with its attributes, along with the plugin's declared footprint. If nothing prints, the adapter is not seeing the platform's events — check that you are on the right page type.
  2. Query the RUM Explorer. Start with the cheapest event to produce:
    @type:action @action.name:commerce.add_to_cart
  3. Place a test order and confirm one commerce.purchase, with value as a number:
    @type:action @action.name:commerce.purchase
    Reload the thank-you page. A second purchase must not appear; the core deduplicates ontransaction_id for 24 hours.
  4. Import the asset pack. The generated metrics need to exist before the dashboard shows anything.

Before you trust the numbers

Reconcile order count against the platform's admin report over a week. The accuracy bar is within 5%. Further out than that usually means one of three things:

These are browser-measured and directional by design. They exist to correlate business outcomes with performance, errors and replays — not to replace the platform's order reporting.

Common options

The same options work on every adapter, so one settings form covers all of them. See a plugin's page for its defaults.

OptionDefaultUse it when
eventsallYou only want part of the funnel
identifyUserstrueTurn off to send no user ID at all
includeEmail / includeNamefalseYou have a lawful basis and want them on the session
includeItemsfalseYou want line-item detail, at up to 20 entries per action
actionPrefixcommerce.The site already has its own naming convention. Only commerce is renamed; other families keep theirs
consentautoignore when the host page already owns trackingConsent, or pass a resolver
beforeTracknoneYou need to edit or drop an event. It cannot reintroduce a blocked attribute
debugfalseWorking out why an event is not arriving