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

voxa-ga

v2.1.0-alpha4

Published

Integrate Google Universal Analytics into your Alexa apps using the voxa framework

Downloads

7

Readme

Voxa Google Analytics

Build Status Coverage Status

A Google Analytics plugin for voxa

Installation

Just install from npm

npm install --save voxa-ga

Important! As of version 1.0, this plugin is designed to work with Analytic properties that are setup as Websites. Previously it was the opposite, working only with Mobile Analytics Properties.

Usage

require("voxa-ga")(skill, config.google_analytics);

Options

{
  trackingId: "UA-XXXXXX-X", // Your app's tracking id
  alexa: "UA-XXXXXX-X", // You can also specify platform specific key based on voxaEvent.platform.name
  google: "UA-XXXXXX-X",  // You can also specify platform specific key based on voxaEvent.platform.name
  appName: "hamurabi", // The application name. If not provided, an attempt will be made to derive it
  appVersion: "1.1", // The applications current version number. If not provided, an attempt will be made to derive it.

  ignoreUsers: [], // An array of users that will be ignored. Useful for blacklisting dev or monitoring accounts from analytics
  suppressSending: false, // A flag to supress sending hits. Useful while developing on the website
  suppressSlots: ['phonenumber'], // An array of slots that shouldn't be logged automatically. Use to remove PII slots.
}

What You Get

By attaching the plugin, for free you get the following

  • Track users by their Alexa user id
  • The paths of each response will be logged as a page view (e.g. Welcome.FirstTimeUser)
  • Events will be logged to track each
    • Intent (category: "Intents", action: "IntentName")
    • State (category: "States", action: "state-name")
    • Slot (category: "Slots", action: "slot-nmae", label: "slot-value")
  • User timings will be logged for
    • Request processing time (how much time your code takes)
    • Each state's occupancy time
  • The device's capabilities (e.g. AudioPlayer) are logged it the flash-version variable
  • Session start/stop bookends
  • The user's locale
  • Exceptions (fatal or caught) are captured
  • Health check events from dialog flow are suppressed. more details

Additionally a ga object is attached to the alexaEvent object, allowing you to log custom events.

Suppressing State Events

Sometimes smaller intermediary states are just not interesting to log. Suppress a state from logging as follows:

skill.onState("my-state", alexaEvent => {
  alexaEvent.ga.ignore();
  return { reply: "Greeting", to: "my-next-state" };
});

Custom Events

Log a custom event by invoking .event on the ga object

skill.onState("my-state", alexaEvent => {
  alexaEvent.ga.event("Category", "Action", "Label", Value);
  return { reply: "Greeting", to: "my-next-state" };
});

Timing

Have something to time? Use the ga object. Remember that the request and each state is already timed for you.

skill.onState("my-state", alexaEvent => {
  alexaEvent.ga.time("Category", "Variable");
  return longRunningOperation()
    .then(() => {
      alexaEvent.ga.timeEnd("Category", "Variable");
    })
    .then(finishIt);
});

Anything Else

Use the visitor object to get access to a universal analytics object.

skill.onState("my-state", alexaEvent => {
  alexaEvent.ga.visitor.transaction("213");
});

Sending events

The plugin will automatically send hits at the end of each request.