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

testpilot-ga

v0.3.0

Published

A library for event-driven data collection with Google Analytics for Firefox Test Pilot.

Downloads

22

Readme

testpilot-ga

testpilot-ga on npm

A library for event-driven data collection with Google Analytics for Firefox Test Pilot experiments. Aims to follow Test Pilot standards for reporting, automatically respects Do Not Track settings.

Table of contents

Usage

  1. Add the testpilot-ga package using your package manager:

    npm install --save testpilot-ga

    or

    yarn add testpilot-ga
  2. Import and create a singleton instance of the TestPilotGA class exported by testpilot-ga:

    import TestPilotGA from 'testpilot-ga';
    
    const analytics = new TestPilotGA({
      aid: '[email protected]',
      an: 'Test Experiment',
      av: '1.0.0',
      cd19: 'production',
      ds: 'addon',
      tid: 'UA-71632928-4'
    });
  3. Use that instance to send events to Google Analytics:

    analytics
      .sendEvent('ec_value', 'ea_value', {
        cd1: 'cd1_value',
        cm1: 'cm1_value'
      })
      .then(response => {
        console.log('Event successfully sent', response)
      })
      .catch((response, err) => {
        console.error('Event failed while sending', response, err)
      });

    Which produces this request:

    POST /collect HTTP/1.1
    Host: www.google-analytics.com
    
    v=1&t=event&tid=UA-71632928-4&cid=00a9e969-362b-4cee-b707-c63e17a4e71a&an=Test%20Experi
    ment&aid=test-experiment%40mozilla.com&aiid=testpilot&aip=1&av=1.0.0&ds=addon&ua=Mozill
    a%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_12_5)%20AppleWebKit%2F537.36%20(KHT
    ML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.115%20Safari%2F537.36&ul=en-US&z=15004209550
    09&ec=catname&ea=eventname&cd1=cd1val1&cm1=cm1val1&cd19=production&cd20=release

More information

  • IRC: #testpilot on irc.mozilla.org