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

@shopyourway/dynamo

v6.0.5

Published

Generate a js API for analytics based on a json file containing the business actions to track

Downloads

13

Readme

Dynamo

alt text

Dynamo generates an analytics javascript API based on a json file definition.

When you report "simple pixels" to GA / MixPanel / Omniture you must implement in your analytics tracker layer all the dimensions and metrics index. For example:

ga('send', 'event', 'Catalogs', 'Add', {
'dimension1': 'Product',
'metric1': 1});

Working that way is hard to keep your analytics aligned between all platforms and feature in your organization. Currently Dynamo support generation a JS API from an input json file. In the future it will also supports other languges.

Using this json file you will be able to have 1 business language for your business analytics. You can create this json file through your CMS system for example and give the ability for PM / data analyst to define the analytics that your product needs to report. Dynamo uses a middle layer called tagManagerReporter that you can later on map to your dimensions and metrics and report to the analytics vendor / tag manager you work with.

Highlights

  • JSON to js
  • Tag manager support
  • Business language over technical language
  • 1 language for your business analytics across all features / platforms

Getting started

Installation

npm (scoped)

Configuration

Import dynamo package:

const generate = require('@shopyourway/dynamo');

Generator Usage

Use the generator instance to generate the js analytics API

const fs = require('fs');

const metadata = JSON.parse(fs.readFileSync('PATH_TO_JSON_FILE'));
const output = generate(metadata, { footerFile: footerFile, importStatements: importStatements });
fs.writeFile('PATH_TO_JS_OUTPUT_API', output);

Example

Suppose you have the following JSON file:

{
  "eventDefinitions": {
    "actionsList": [
      "Add To Catalog"
    ]
  },
  "definitions": {
    "addToCatalog": {
      "parameters": {
        "entityType": "string"
      },
      "dimensions": {
        "eventAction": "Add To Catalog",
        "entityType": "{{entityType}}"
      },
      "metrics": [ "engagementMetric", "addToCatalogMetric" ],
      "eventType": "event"
    }
  }
}

The output will be:

import tagManagerReporter from './tag-manager-reporter';

export var actions = {
  "addToCatalog": "Add To Catalog"
};
var actionsValues = {
  "Add To Catalog": 1
};

export function addToCatalog(entityType) {
  const eventData = {};

  eventData.eventAction = `Add To Catalog`;
  eventData.entityType = `${entityType}`;
  eventData.engagementMetric = `1`;
  eventData.addToCatalogMetric = `1`;
  tagManagerReporter.link(eventData);
}

With the new file you can

myGeneratedAnalytics.addToCatalog('Product');

Development

How to contribute

We encorage contribution via pull requests on any feature you see fit.

When submitting a pull request make sure to do the following:

  • Check that new and updated code follows OhioBox existing code formatting and naming standard
  • Run all unit and integration tests to ensure no existing functionality has been affected
  • Write unit or integration tests to test your changes. All features and fixed bugs must have tests to verify they work Read GitHub Help for more details about creating pull requests

Running tests

To run tests, in command line simply run npm test