0.0.0 • Published 7 years ago

ui-tracking v0.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

ui-tracking Build Status

The ui-tracking repo contains code related to user analytics and tracking with any number of third-party tracking vendors. It is responsible for:

  • Collecting shared tracking-related information
  • Holding APIs for modules and apps that provide tracking methods
  • Managing third-party tracking code

This code contained within this repository is not meant to be used directly by the public. Rather, it exists as an open repository to further our open source initiatives and to share our patterns and practices around user analytics and behavior tracking.

Requirements

This repository requires Node 7.3.0 and NPM 4.1.1 or higher. The tooling will assert the minimum NPM version required.

Tooling

Tooling is provided by bosun.

For a list of commands, run gulp help.

To specify a module to perform a task for, use the --src flag. eg. --src vendor/waypoints.

Contributing

Publishing Modules

All modules should be published using npm publish. No other commands are necessary. Tests and other tasks will be run as part of the prepublish script.

Gilt Data Team are the gatekeepers of the repo and primary reviewers. Pull Requests shouldn't be merged until a member of Data has had a chance to review.

Publishing should be done from the root directory, but should work as long as the proper path is specified. eg. npm publish src/vendor/waypoints.

Tests

All modules within this repo are required to have assertions to validate their exports.

All tracking.* modules are required to have, at the minimum, tests to validate their exports, as well as validate all event names being sent through Gumshoe.

All tests should be authored with mocha and chai.

Spies are provided through chai-spies. Please reference the github README for chai-spies, as the plugin page has fallen behind the current state of the project.

Module Version Metadata

Modules are no longer required to have $$PACKAGE_VERSION$$ declared in source. The bosun publish lifecycle will inject a metadata module to the end of each file in a module's js directory, prior to publish.

Vendor Modules

Vendor modules (vendor.*) in this repo make use of npm prepublish scripts to automatically wrap the vendor code in gilt.define. Vendor code is stored in a lib directory within a module. Output will be rendered to the js directory for a given module directory.

Module Versions

To query the version of any module published from this repository within a browser, simply require

Owner

Code ownership is shared; the point of a separate repo is so that people who are not front-end engineers can review code easily and see changes when they are made.

Rationale

The reason for this repo is that managing tracking through pubsub, as we have done for several years, is not coupled tightly enough to prevent errors from occurring, and when errors occur, they are painful. Also, it does not provide for non-engineers to look over code easily.

Tree

  • tracking
    • contains tracking modules for various parts of the ecosystem
      • component (maps to a component module)
      • web (maps to an application name)
      • other (maps to other named modules)
  • common
    • contains modules which share common functions through the ecosystem
  • tracking_api
    • provides API wrapping and mapping to vendor API

The idea is that applications and modules can track at the point where something occurs, but they are using our own tracking methods and agnostic as to what is done with the tracking calls after they are made. Once the calls get to the tracking modules, they can collect the data together with shared data provided through common.tracking_metadata, and fire off whatever specific third-party calls are necessary.