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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@adobe/spacecat-shared-rum-api-client

v2.12.0

Published

Shared modules of the Spacecat Services - Rum API client

Downloads

2,556

Readme

Spacecat Shared - RUM API Client

A JavaScript client for Adobe's Real User Monitoring (RUM) API, part of the SpaceCat Shared library.

Installation

Install the package using npm:

npm install @adobe/spacecat-shared-rum-api-client

Usage

Creating and instance from Helix UniversalContext

const context = {}; // Your AWS Lambda context object
const rumApiClient = RUMAPIClient.createFrom(context);

From constructor

const rumApiClient = new RUMAPIClient();

Running a query

const opts = {
  domain: 'www.aem.live',
  domainkey: '<domain-key>',
  granularity: 'hourly',
  interval: 10
}

const result = await rumApiClient.query('cwv', opts);
console.log(`Query result: ${result}`)

Note: all queries must be lowercase

Query Options: the 'opts' object

| option | required | default | remarks | |-------------|----------|---------|---------------------| | domain | yes | | | | domainkey | yes | | | | interval | no | 7 | days in integer | | granularity | no | daily | 'daily' or 'hourly' |

Available queries

cwv

Calculates the CWV data for a given domain within the requested interval. It gets the P75 values for LCP, CLS, INP, TTFB metrics, along with the number of data points available for each metric. Additionally, it provides grouping by URL and includes the count of page view data.

An example response:

[
  {
    "url": "https://www.aem.live/home",
    "pageviews": 2620,
    "lcp": 2099.699999988079,
    "lcpCount": 9,
    "cls": 0.020660136604802475,
    "clsCount": 7,
    "inp": 12,
    "inpCount": 3,
    "ttfb": 520.4500000476837,
    "ttfbCount": 18
  },
  {
    "url": "https://www.aem.live/developer/block-collection",
    "pageviews": 2000,
    "lcp": 512.1249999403954,
    "lcpCount": 4,
    "cls": 0.0005409526209424976,
    "clsCount": 4,
    "inp": 20,
    "inpCount": 2,
    "ttfb": 122.90000003576279,
    "ttfbCount": 4
  }
]

404

Calculates the number of 404 errors for a specified domain within the requested interval. The results are grouped by URL and the source of the 404 error. The output includes all the various sources that direct traffic to the 404 page, as well as the total number of views originating from these sources.

An example response:

[
  {
    "url": "https://www.aem.live/developer/tutorial",
    "views": 400,
    "all_sources": [
      "https://www.google.com",
      "",
      "https://www.instagram.com"
    ],
    "source_count": 3,
    "top_source": "https://www.google.com"
  },
  {
    "url": "https://www.aem.live/some-other-page",
    "views": 300,
    "all_sources": [
      "https://www.bing.com",
      ""
    ],
    "source_count": 2,
    "top_source": ""
  },
  {
    "url": "https://www.aem.live/developer/",
    "views": 100,
    "all_sources": [
      ""
    ],
    "source_count": 1,
    "top_source": ""
  }
]

experiment

Lists all the experiments for a specified domain within the requested interval. The results are grouped by URL. The output includes all the URLs running the experiment, along with experiment id, variants, number of clicks/convert/formsubmit events per variant/selector and views for each of the variant in the experiment.

An example response:

{
  "https://www.aem.live/home": [
    {
      "experiment": "short-home",
      "variants": [
        {
          "name": "challenger-1",
          "views": 1300,
          "click": {
            ".hero": 100,
            ".header #navmenu-0": 100,
            ".roi-calculator .button": 100,
            ".hero .button": 100
          },
          "convert": {},
          "formsubmit": {}
        },
        {
          "name": "control",
          "views": 800,
          "click": {
            ".hero .button": 100,
            ".header .button": 200,
            ".header #navmenu-0": 200
          },
          "convert": {},
          "formsubmit": {}
        }
      ]
    }
  ],

  "https://www.aem.live/new-exp-page": [
    {
      "experiment": "visitor-behavior",
      "variants": [
        {
          "name": "https://www.aem.live/some-other-page",
          "views": 500,
          "click": {},
          "convert": {},
          "formsubmit": {}
        }
      ]
    }
  ]
}

high-inorganic-high-bounce-rate (Experimentation Opportunity)

Calculates the amount of inorganic traffic and the bounce rate for each page. Identifies pages with both high inorganic traffic and high bounce rates, which can be targeted for future experimentation opportunities. An example payload is provided below:

[
  {
    "type": "high-inorganic-high-bounce-rate",
    "page": "https://www.spacecat.com/",
    "screenshot": "",
    "trackedPageKPIName": "Bounce Rate",
    "trackedPageKPIValue": 0.6507592190889371,
    "trackedKPISiteAverage": "",
    "pageViews": 46100,
    "samples": 46100,
    "metrics": [
      {
        "type": "traffic",
        "value": {
          "total": 46100,
          "paid": 40700,
          "owned": 5400,
          "earned": 0
        }
      }
    ]
  },
  {
    "type": "high-inorganic-high-bounce-rate",
    "page": "https://www.spacecat.com/pricing",
    "screenshot": "",
    "trackedPageKPIName": "Bounce Rate",
    "trackedPageKPIValue": 0.8723897911832946,
    "trackedKPISiteAverage": "",
    "pageViews": 43100,
    "samples": 43100,
    "metrics": [
      {
        "type": "traffic",
        "value": {
          "total": 43100,
          "paid": 24100,
          "owned": 19000,
          "earned": 0
        }
      }
    ]
  }
]

high-organic-low-ctr (Experimentation Opportunity)

Calculates the amount of non-inorganic (earned and owned) traffic and the click-through rate for each page and vendor. Identifies pages with high non-inorganic traffic and low click-through rates, which can be targeted for future experimentation opportunities. An example payload is provided below:

[
  {
    "type": "high-organic-low-ctr",
    "page": "https://www.spacecat.com/about-us",
    "screenshot": "",
    "trackedPageKPIName": "Click Through Rate",
    "trackedPageKPIValue": 0.14316702819956617,
    "trackedKPISiteAverage": 0.40828402366863903,
    "pageViews": 46100,
    "samples": 46100,
    "metrics": [
      {
        "type": "traffic",
        "vendor": "*",
        "value": {
          "total": 46100,
          "paid": 300,
          "owned": 45800,
          "earned": 0
        }
      },
      {
        "type": "ctr",
        "vendor": "*",
        "value": {
          "page": 0.14316702819956617
        }
      },
      {
        "type": "traffic",
        "vendor": "tiktok",
        "value": {
          "total": 300,
          "owned": 0,
          "earned": 0,
          "paid": 300
        }
      },
      {
        "type": "ctr",
        "vendor": "tiktok",
        "value": {
          "page": 0.3333333333333333
        }
      }
    ]
  }
]

form-vitals

Collects form vitals for a specified domain within a given time interval. Identifies whether each URL has embedded forms and counts form views/submission/engagement. This data can infer opportunities, such as URLs with low CTR and limited form engagement, URLs with high page views but fewer form submissions etc. An example response:

[
  {
    "url": "https://business.adobe.com/",
    "formsubmit": {},
    "formview": {
      "desktop:mac": 800,
      "desktop:windows": 1900,
      "mobile:ios": 100,
      "mobile:android": 300
    },
    "formengagement": {
      "desktop:windows": 100
    },
    "pageview": {
      "desktop:mac": 800,
      "desktop:windows": 1900,
      "mobile:ios": 100,
      "mobile:android": 300
    }
  },
  {
    "url": "https://business.adobe.com/se/resources/main.html",
    "formsubmit": {      
      "desktop:windows": 100
    },
    "formview": {},
    "formengagement": {
      "desktop:windows": 100
    },
    "pageview": {
      "desktop:windows": 100
    }
  }
]

Linting

Lint the codebase using:

npm run lint

Cleaning

To clean the package (remove node_modules and package-lock.json):

npm run clean

Repository

Find the source code and contribute here.

Issues

Report issues or bugs here.

License

This project is licensed under the Apache-2.0 License.