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

@ombori/grid-reports

v4.1.27

Published

This library helps to build schema for analytics reports.

Downloads

408

Readme

Grid Reports Library

This library helps to build schema for analytics reports.

Installation

npm i @ombori/grid-reports --save or yarn add @ombori/grid-reports

Example

import {
  AnalyticsSchema,
  CardType,
  SessionInteractionType,
} from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.Sessions, interactionType: SessionInteractionType.Interactive },
      ],
    },
  ],
};

export default analyticsSchema;

As a result of the above example, you will get an analytics report with one card that shows information about user sessions.

Example

Analytics schema is an object that should match AnalyticsSchema type. Do not forget to export your schema using default export.

Description

There are several types that helps you to build analytics schema.

AnalyticsSchema

import { AnalyticsSchema } from '@ombori/grid-reports';

Top level type for your analytics schema.

import { AnalyticsSchema } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {};

export default analyticsSchema;

Options

  • groups: object[]
    • Required
    • List of groups for this analytics report.

Group

Analytics report consists of groups of reports. Each group defines its own list of report cards. If you have a big analytics report with a lot of data it maybe handy to split data into several groups.

import { AnalyticsSchema } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [],
    },
  ],
};

export default analyticsSchema;

Property groups defines a list of analytics report groups.

One group has next options.

Options

  • name: string
    • Required
    • Defines report group name.
  • cards: object[]
    • Required
    • List of cards for this report group.
  • columnsCount: number
    • Optional
    • Defines number of columns for report group layout.
  • gridStyles: object
    • Optional
    • It is possible to customize report group layout with grid-* css properties. For example, gridStyles: { 'grid-gap': '20px' }.

Card

Each report group has its own list of analytics cards.

import { AnalyticsSchema, CardType, SessionInteractionType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        {
          type: CardType.Sessions,
          interactionType: SessionInteractionType.Interactive,
        }
      ],
    },
  ],
};

export default analyticsSchema;

Cards

Each card is an object with a certain type and card specific properties.

Sessions card

Adds card with data about user sessions to the report group.

import { AnalyticsSchema, CardType, SessionInteractionType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        {
          type: CardType.Sessions,
          interactionType: SessionInteractionType.Interactive,
        }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.Sessions
    • Required
  • interactionType: SessionInteractionType
    • Optional
    • Defines the type of sessions data to be shown. Use SessionInteractionType enum.
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Sessions card

Nps card

Adds card with data about NPS score and number of nps replies.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.Nps }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.Nps
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

NPS card

EventsList card

Adds card with list of captured events.

import { AnalyticsSchema, CardType, InteractionType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.EventsList, interactionType: InteractionType.Interactive,   title: 'Sesame success rate',
          dataSource:  DataSourceBaseEntity.Space,
          dataSourceType: DataSourceTypeEntityEnum.LOCATION,
          events: [
            {
              title: 'Success',
              eventTypes: ['EXIT_ZONE_VALID_RECEIPT'],
              color: '#57CD65',
            }
          ],
          additionalData: [
            {
              icon: 'https://storemanager.itab.com/assets/img/sales.svg',
              title: 'Total',
              eventTypes: ['CHECKOUT_ISSUE_RECEIPT', 'CHECKOUT_ISSUE_RECEIPT_NO_ID'],
            },
          ],
        },
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.EventsList
    • Required
  • interactionType: InteractionType
    • Optional
    • Defines the type of events data to be shown. Use InteractionType enum.
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • title: string
    • Optional
    • It is possible to show title in the card rather show hard coded value in from the console.
  • events: array of object
    • Optional
    • Defines the array of events data to be shown.
  • additionalData: array of object
    • Optional
    • Defines the array of additionalData events data to be shown.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.
  • datasource: DataSourceBaseEntity
    • Optional
    • Defines the type of source data to be shown. Use DataSourceBaseEntity enum.
  • datasource: DataSourceTypeEntityEnum
    • Optional
    • Defines the type of space data to be shown. Use DataSourceTypeEntityEnum enum.

Events list card

EventsFunnel card

Adds card with events funnel based on predefined list of events.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        {
          type: CardType.EventsFunnel,
          title: 'Sales conversions funnel',
          events: ['CATEGORY_VIEW', 'PRODUCT_VIEW', 'CART_ADD', 'CHECKOUT', 'PURCHASE'],
        },
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.EventsFunnel
    • Required
  • title: string
    • Required
    • Defines card title.
  • events: string[]
    • Required
    • Defines list of events that should be used to build events funnel. For example, ['CATEGORY_VIEW', 'PRODUCT_VIEW', 'CART_ADD', 'CHECKOUT', 'PURCHASE'].
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Events funnel card

ProductsEventCount card

Adds card with list of captured product events.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        {
          type: CardType.ProductsEventCount,
          eventType: 'PRODUCT_VIEW',
          title: 'Product views',
        },
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.ProductsEventCount
    • Required
  • title: string
    • Required
    • Defines card title.
  • eventType: string
    • Required
    • Defines an event type.
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Products event count card

CategoriesEventCount card

Adds card with list of captured product categories events.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.CategoriesEventCount },
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.CategoriesEventCount
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Categories event count card

EventsFlow card

Adds card that shows flow of captured events.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.EventsFlow }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.EventsFlow
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Events flow card

WeekHeatmap card

Adds card with sessions or events data that is shown as a heatmap.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        {
          type: CardType.WeekHeatmap,
          title: 'Sessions week heatmap',
          dataSource: {
            type: WeekHeatmapDataSourceType.Sessions,
            interactionType: SessionInteractionType.Interactive,
          },
        },
      ],
    },
  ],
};

export default analyticsSchema;
  • type: CardType.WeekHeatmap
    • Required
  • title: string
    • Required
    • Defines card title.
  • dataSource: WeekHeatmapDataSourceSessions | WeekHeatmapDataSourceEvents
    • Required
    • WeekHeatmapDataSourceSessions: { type, interactionType }
      • type: WeekHeatmapDataSourceType.Sessions
        • Required
      • interactionType: SessionInteractionType
        • Optional
    • WeekHeatmapDataSourceEvents: { type, eventType }
      • type: WeekHeatmapDataSourceType.Events
        • Required
      • eventType: string
        • Required
        • Defines the specific event type to be used as data source. For example, CART_ADD.
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Week heatmap card

AverageSales Card

Adds card with data about average sales.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.AverageSales }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.AverageSales
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

AverageSales card

AverageTimeBetweenTransactions Card

Adds card with data about average time between transactions.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.AverageTimeBetweenTransactions }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.AverageTimeBetweenTransactions
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

AverageTimeBetweenTransactionsCard card

AverageNumberOfPurchasedProducts Card

Adds card with data about average number of purchased products per transaction.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.AverageNumberOfPurchasedProducts }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.AverageNumberOfPurchasedProducts
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

AverageNumberOfPurchasedProducts card

PurchasedProductsEventCount Card

Adds card with data about purchased products.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.PurchasedProductsEventCount }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.PurchasedProductsEventCount
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

PurchasedProductsEventCount card

PurchasedProductsCategoriesEventCount Card

Adds card with data about purchased products categories.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.PurchasedProductsCategoriesEventCount }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.PurchasedProductsCategoriesEventCount
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

PurchasedProductsCategoriesEventCount card

QrCodesCount Card

Adds card with data about scanned qr codes.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.QrCodesCount }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.QrCodesCount
    • Required
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

QrCodesCount card

Media Card

Adds card with data in tabular format about media content that has been played.

import { AnalyticsSchema, CardType } from '@ombori/grid-reports';

const analyticsSchema: AnalyticsSchema = {
  groups: [
    {
      name: 'Overview',
      cards: [
        { type: CardType.Media }
      ],
    },
  ],
};

export default analyticsSchema;

Options

  • type: CardType.Media
    • Required
  • primaryKey: MediaCardPrimaryKeyType
    • Required
    • Defines the primary key for the data table. Use MediaCardPrimaryKeyType enum.
  • title: string
    • Optional
    • Defines card title.
  • gridStyles: object
    • Optional
    • It is possible to customize card layout with grid-* css properties.
  • isVisibleWithoutData: boolean
    • Optional
    • Defines if card should be visible if there is no data to show. Default value is false.

Media card

Media tag card

Media device card