mrpanalytics

1.0.34 • Public • Published

mrpanalytics Circle CI

Client side Analytics using the W3C CEDDL Digital Data JSON.

This module is a wrapper to the global 'Analytics' lib. This module only handles event tracking - e.g. Add To Bag.

For more info on the W3C Digital Data JSON, see:

https://confluence.nap/pages/viewpage.action?pageId=18617146

Install

npm install mrpanalytics

usage

Require module

var MrpAnalytics = require('mrpanalytics');

On DOM Ready

MrpAnalytics.setUp(window.digitalData, window.NAP.WebAn);
  • window.digitalData - Global odject containg information about the page and any products. Using the W3C CEDDL standard
  • window.analytics - Global Analytics JS lib injected into the using Adobe Analytics.

Track event - e.g. Add To Bag

MrpAnalytics.trackEvent(eventJson);
  • eventJson - JSON object containing information about the event based on the following format:
  • eventName - e.g. 'Add To Bag',
  • effect - e.g. 'Added to bag',
  • quantity
  • size
  • sku

Helper Properties

  SITE_WIDE_EVENTS = {
      "addToCart": {
          "eventName": "add to cart",
          "effect": "update cart"
      }
  }

Provides a list of site wide 'eventName' and 'effect' properties.

Package Sidebar

Install

npm i mrpanalytics

Weekly Downloads

3

Version

1.0.34

License

MIT

Last publish

Collaborators

  • mrporteradmin