Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ddl-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddl-json-schema

JSON Schema for the W3C Customer Experience Digital Data Layer

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

JSON Schema for the W3C Customer Experience Digital Data Layer.

What is the W3C Customer Experience Digital Data Layer?

The W3C Customer Experience Digital Data Layer is a specification that describes a method for exposing customer data through a global JavaScript object in a consistent manner that can be consumed by multiple vendors.

Why do I need this module?

If you are building a service that consumes the contents of the Digital Data Layer you may want to validate the data coming in and verify that it conforms to the expected format.

If you are building an ecommerce website that exposes the Digital Data Layer, you might have a test suite where you verify that the data you are exposing conforms to the expected format.

How do I install and use it?

npm install ddl-json-schema
var schema = require("ddl-json-schema");

schema.root;
// this is a schema defines the entire digitalData object

schema.attributes;
// this schema describes a valid attributes object

schema.security;
// this schema describes a valid security object or string

schema.category;
// this schema describes a valid category object

schema.product;
// this schema describes a valid product object

schema.price;
// this schema describes a valid price object

schema.address;
// this schema describes a valid address object

schema.date;
// this schema describes a valid date string

What's new?

In version 2.0.0 there is an API change in terms of what is exported as the module. Instead of exporting the overall digitalData schema as the default export, we now export schemas for a number of W3C Customer Experience Digital Data Layer components. This is meant to enable more granular validation, for instance if your api only receives a product object (or array) rather than the entire digitalData object, and you still want to validate these objects against the specification.

Looking for more information about the schema?

The window.digitalData object may be extended in many ways. The objects in the specification are not required to be present, but if they are used they must adhere to the specified property names and types. On the global object the following names are reserved properties on the digitalData object: pageInstanceID, page, product, cart, transaction, event, component, user, privacy, version.

Reserved propertyTypeSpecification
pageInstanceIDstring
pageobjectspecification
productarrayspecification
cartobjectspecification
transactionobjectspecification
eventarrayspecification
componentarrayspecification
userarrayspecification
privacyobjectspecification
versionstring

Project logo created by Valeriy from the Noun Project.

FAQs

Package last updated on 24 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc