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

mp-ga-enhancer-ecommerce

v0.1.4

Published

E-Commerce enhancer for mp-ga-tracker.

Readme

mp-ga-enhancer-ecommerce

E-Commerce enhancer for mp-ga-tracker.

Installation

$ npm install mp-ga-enhancer-ecommerce --save

Usage

// import the main SDK, which should be installed separately
import GaTracker from 'mp-ga-tracker'
// import the E-Com enhancer
import * as gaTrackerEcomEnhancer from 'mp-ga-enhancer-ecommerce'

// init the GA tracker
// see more details in the doc of mp-ga-tracker
const gaTracker = new GaTracker(...config)

// inject as the non-first argument of the gaTracker tracking methods that supports the enhancers
// for example, trackScreenview
gaTracker.trackScreenview(
  'screen_view',
  gaTrackerEcomEnhancer.impression([
    index: 2,
    nm: 'Product Impression List Name',
    products: [
      {
        id: 'Product Impression SKU',
        nm: 'Product Impression Name',
        ps: 'Product Impression Position',
      },
    ],
  ]),
)

API

  • All the API supports the list and products type to be either Array or Object
  • While the <listIndex> and <productIndex> would be automatically generated, they could be overridden by simply attaching a specific index value (NOTE: index value should be in the range [1, 200])

impression(Array | Object)

The activity of a product being displayed somewhere, e.g. PLP.

impression([
  {
    // list `nm` is required
    nm: 'Product Impression List Name',
    // ?optional, to specify the index value
    index: 2,
    // the products could be either object or array
    products: {
      // product `id`, `nm`, `ps` are required
      id: 'Product Impression ID',
      nm: 'Product Impression Name',
      ps: 'Product Impression Position',
      // product `pr`, `br`, `ca`, `va` are optional
      pr: 'Product Impression Price',
      br: 'Product Impression Brand',
      ca: 'Product Impression Category',
      va: 'Product Impression Variant',
    },
  },
])

// the argument could be an object as well
impression({
  nm: 'Product Impression List Name',
  products: [],
})

click(Object)

The activity of a product being clicked on.

click({
  pal: 'Product Action List',
  products: {
    // `id`, `nm`, `ps` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    // `pr`, `br`, `ca`, `va`, `qt`, `cc` are optional
    pr: 'Product Price',
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    qt: 'Product Quantity',
    cc: 'Product Coupon Code',
  },
})

detail(Object)

The activity of a PDP being viewed.

detail({
  pal: 'Product Action List',
  products: {
    // `id`, `nm`, `ps` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    // `pr`, `br`, `ca`, `va`, `qt`, `cc` are optional
    pr: 'Product Price',
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    qt: 'Product Quantity',
    cc: 'Product Coupon Code',
  },
})

add(Object)

The activity of a product being added to cart.

add({
  products: {
    // `id`, `nm`, `ps`, `pr`, `qt` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    pr: 'Product Price',
    qt: 'Product Quantity',
    // `br`, `ca`, `va`, `cc` are optional
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    cc: 'Product Coupon Code',
  },
})

remove(Object)

The activity of a product being removed from cart.

remove({
  products: {
    // `id`, `nm`, `ps`, `pr`, `qt` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    pr: 'Product Price',
    qt: 'Product Quantity',
    // `br`, `ca`, `va`, `cc` are optional
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    cc: 'Product Coupon Code',
  },
})

checkout(Object)

The activity of a product being checked out.

checkout({
  // `cos`, `col` are optional
  cos: 'Checkout Step',
  col: 'Checkout Option',
  products: {
    // `id`, `nm`, `ps`, `pr`, `qt` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    pr: 'Product Price',
    qt: 'Product Quantity',
    // `br`, `ca`, `va`, `cc` are optional
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    cc: 'Product Coupon Code',
  },
})

purchase(Object)

The activity of a product being purchased and order being created.

purchase({
  // `ti`, `tr` are required
  ti: 'Transaction/Order ID',
  tr: 'Transaction Revenue',
  // `tt`, `ts`, `tcc` are optional
  tt: 'Transaction Tax',
  ts: 'Transaction Shipping',
  tcc: 'Transaction Coupon Code',
  products: {
    // `id`, `nm`, `ps`, `pr`, `qt` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    pr: 'Product Price',
    qt: 'Product Quantity',
    // `br`, `ca`, `va`, `cc` are optional
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    cc: 'Product Coupon Code',
  },
})

refund(Object)

The activity of a product and its transaction being refunded.

refund({
  // `ti`, `tr` are required
  ti: 'Transaction/Order ID',
  tr: 'Transaction Revenue',
  // `tt`, `ts`, `tcc` are optional
  tt: 'Transaction Tax',
  ts: 'Transaction Shipping',
  tcc: 'Transaction Coupon Code',
  products: {
    // `id`, `nm`, `ps`, `pr`, `qt` are required
    id: 'Product SKU'
    nm: 'Product Name',
    ps: 'Product Position',
    pr: 'Product Price',
    qt: 'Product Quantity',
    // `br`, `ca`, `va`, `cc` are optional
    br: 'Product Brand',
    ca: 'Product Category',
    va: 'Product Variant',
    cc: 'Product Coupon Code',
  },
})