npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@adobe/content-analytics

v1.0.53

Published

Adobe Content Analytics Library - Standardized collection of content interactions for reporting

Readme

@adobe/content-analytics

Build npm npm

Adobe Content Analytics Library — standardized collection of content interactions (page views, asset views, clicks, scroll depth) for reporting. The library sends content-related events to Adobe Experience Platform via the Alloy Web SDK. Use it when you want Content Analytics without Adobe Experience Platform Tags (Launch).

Prerequisites: Adobe Experience Platform Web SDK (Alloy) must be initialized on the page before calling initializeContentLibrary.

Installation

npm package

npm install @adobe/content-analytics
import initializeContentLibrary from "@adobe/content-analytics";

Script tag (CDN)

Load the prebuilt standalone bundle after Alloy is initialized:

<!-- 1. Load and configure Alloy first -->
<script src="https://cdn1.adoberesources.net/alloy/2.x.x/alloy.min.js"></script>
<script>
  alloy("configure", {
    datastreamId: "YOUR_DATASTREAM_ID",
    orgId: "YOUR_ORG_ID@AdobeOrg",
  });
</script>

<!-- 2. Load Content Analytics (pin the version in production if you prefer) -->
<script src="https://unpkg.com/@adobe/[email protected]/dist/content-analytics.min.js"></script>
<script>
  window.contentAnalytics({
    datastreamId: "YOUR_DATASTREAM_ID",
  });
</script>

The standalone build exposes window.contentAnalytics as the initialization function (same behavior as the default export from npm).

Quick start

import initializeContentLibrary from "@adobe/content-analytics";

initializeContentLibrary({
  datastreamId: "your-datastream-id",
  includeExperiences: true,
});

Datastream configuration

The datastreamId option is required and must reference a datastream that has the Experience Platform service configured with an enabled Content Analytics experience event dataset. Ensure the sandbox associated with the datastream is not already associated with another Content Analytics setup.

You can supply separate datastream IDs per environment:

initializeContentLibrary({
  datastreamId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // production
  stagingDatastreamId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // optional
  developmentDatastreamId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // optional
});

Experience capture and definition

Enable experience tracking and control how experiences are identified on your website. Experiences are defined by combining a domain regular expression with optional query parameters that distinguish one experience from another within matching pages.

| Option | Type | Default | Description | |--------|------|---------|-------------| | includeExperiences | boolean | false | Enable page/experience view tracking | | experienceConfigurations | array | — | Define experiences by domain regex and query parameters | | htmlPathCollectionEnabled | boolean | true | Collect DOM HTML path for assets | | htmlPathAttributes | array | ["class","role","data-block-name"] | HTML attributes included in DOM path | | htmlPathDepth | number | 25 | Maximum DOM depth for HTML path collection | | imagesSelector | string | "img" | CSS selector identifying trackable assets |

Each entry in experienceConfigurations accepts:

| Property | Type | Description | |----------|------|-------------| | regEx | string | Domain regular expression matched against the page URL (e.g. ^(?!.*\b(store\|help\|admin)\b)) | | queryParameters | array | Query parameter names whose values distinguish experiences on matching pages (e.g. ["outdoors", "patio", "kitchen"]) |

Example — domain regex and query parameters:

initializeContentLibrary({
  datastreamId: "YOUR_DATASTREAM_ID",
  includeExperiences: true,
  experienceConfigurations: [
    {
      regEx: "^https://www\\.example\\.com/products",
      queryParameters: ["category", "collection"],
    },
    {
      regEx: "^https://www\\.example\\.com/blog",
      queryParameters: [],
    },
  ],
});

Event filtering

Control which page URLs and asset URLs are included in data collection using regular expressions. Validate patterns with a regex tester before deployment.

| Option | Type | Default | Description | |--------|------|---------|-------------| | pageUrlQualifier | string (regex) | — | Only track pages whose URL matches this pattern | | assetUrlQualifier | string (regex) | — | Only track assets whose URL matches this pattern | | excludeURLsFromTracking | array | [] | List of URL strings to exclude from tracking |

Example — excluding documentation and scoping to product images:

initializeContentLibrary({
  datastreamId: "YOUR_DATASTREAM_ID",
  pageUrlQualifier: "^(?!.*\\/documentation).*",
  assetUrlQualifier: ".*\\/products\\/.*\\.(?:jpg|png|webp)",
  excludeURLsFromTracking: [
    "https://www.example.com/internal",
    "https://www.example.com/staging",
  ],
});

Additional options

| Option | Type | Default | Description | |--------|------|---------|-------------| | datastreamId | string | required | AEP datastream ID (see Datastream configuration) | | scrollDepthCollectionEnabled | boolean | true | Track scroll depth | | assetsMaxBatchLength | number | 32 | Max assets before auto-send | | debounceNodeRegister | number | 500 | Debounce for DOM observation (ms) | | throttleSendContentEvent | number | 500 | Throttle for event sending (ms) |

Requirements

  • Adobe Experience Platform Web SDK (Alloy) must be initialized
  • Modern browser with IntersectionObserver and MutationObserver support

Development

npm install
npm test
npm run build
npm run lint

Contributing

Contributions are welcome! See Contributing Guide for more information.

License

Apache-2.0. See LICENSE for details.