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

ddl-json-schema

v2.0.0

Published

JSON Schema for the W3C Customer Experience Digital Data Layer

Downloads

4

Readme

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 property | Type | Specification | | ----------------- | -------- | --------------------------------------------- | | pageInstanceID | string | | | page | object | specification | | product | array | specification | | cart | object | specification | | transaction | object | specification | | event | array | specification | | component | array | specification | | user | array | specification | | privacy | object | specification | | version | string | |

Project logo created by Valeriy from the Noun Project.