@artsy/cohesion
Analytics schema and library helpers
Last updated 3 days ago by artsy-engineering .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @artsy/cohesion 
SYNC missed versions from official npm registry.

Cohesion CircleCI npm version

Artsy's analytics schema & event helpers

Contributing

Requirements: Yarn

Set up:

yarn install

Run tests:

yarn test

Generate docs:

yarn docs

To view docs locally, visit the full filepath of docs/index.html in your browser, i.e, file:///Users/<MY_USER>/<MY_LOCAL_DIRECTORY>/cohesion/doc/index.html

Schema

The /Schema directory represents the Artsy's analytics schema, and describes expectations for data consumed by Redshift and Segment.

This schema is maintained by Artsy's data team, engineers should not expect to change these files.

Valid analytics events are described in /Schema/Events/index.ts, and individual event schemas live in the Schema/Events directory, divided by concern.

Typings for all allowed values, such as ContextModule, are exported for use by engineers in consuming projects.

Add a new event to the schema (For data analysts)

  1. In Schema/Events, add the name of the new event. This name defines the corresponding downstream table's name in Redshift, and should use the lowerCamelCase naming convention.
// Schema/Events/index.ts

export enum ActionType {
  ...
  myNewEvent = "myNewEvent",
  ...
}

  1. In Schema/Events directory, create a new interface describing the shape of the new event, as it is received in Segment/Redshift.
  • The name of the interface should match the ActionType created in step 1, but use the UpperCamelCase naming convention.
  • The action key is required and should match the ActionType created in step 1.
  • If your event uses values not yet in the schema, such as a new ContextModule, add new values to the existing typings in the Schema directory.
// Schema/Events/MyNewEvent.ts

export interface MyNewEvent {
  action: ActionType.myNewEvent
  context_module: ContextModule
  optional_property?: string
  required_property: number
}
  1. In Schema/Events/index.ts, add the new interface to the valid events master list, Event

  2. Add descriptive comments with examples to explain the use of your new event. Our documentation is generated automatically from in-code comments, find more information on syntax in the typedoc docs.

  3. If you have created any new files, add an export statement to Schema/index.ts like so:

// Schema/index.ts

export * from "./Events/MyNewEvent"
  1. PR your changes. Once merged, the schema will be updated and your new event and values will be available to consumers of this package.

  2. Data analysts should request an engineer to construct a new event helper for the /Helpers directory (see below).

Helpers

The /Helpers directory contains javascript helpers that return schema-compliant analytics events, and provide some useful default values. Each helper corresponds to one event from /Schema/Events.

Engineers should use these helpers whenever sending analytics data to Segment, for example, when creating an analytics event with react-tracking.

Current Tags

  • 1.24.1-canary.87.1270.0                                ...           canary (10 days ago)
  • 1.28.0                                ...           latest (3 days ago)

103 Versions

  • 1.28.0                                ...           3 days ago
  • 1.27.0                                ...           3 days ago
  • 1.26.0                                ...           9 days ago
  • 1.25.0                                ...           10 days ago
  • 1.24.1-canary.87.1270.0                                ...           10 days ago
  • 1.24.0                                ...           14 days ago
  • 1.23.0                                ...           17 days ago
  • 1.22.0                                ...           17 days ago
  • 1.21.0                                ...           a month ago
  • 1.20.0                                ...           a month ago
  • 1.19.0                                ...           a month ago
  • 1.18.0                                ...           a month ago
  • 1.17.0                                ...           a month ago
  • 1.16.0                                ...           a month ago
  • 1.15.0                                ...           a month ago
  • 1.14.0                                ...           2 months ago
  • 1.13.0                                ...           2 months ago
  • 1.12.0                                ...           2 months ago
  • 1.11.0                                ...           2 months ago
  • 1.10.0                                ...           2 months ago
  • 1.9.0                                ...           2 months ago
  • 1.8.0                                ...           2 months ago
  • 1.7.0                                ...           2 months ago
  • 1.6.2                                ...           2 months ago
  • 1.6.1                                ...           2 months ago
  • 1.6.0                                ...           2 months ago
  • 1.5.0                                ...           2 months ago
  • 1.4.0                                ...           2 months ago
  • 1.3.0                                ...           3 months ago
  • 1.2.0                                ...           3 months ago
  • 1.1.0                                ...           3 months ago
  • 1.0.5                                ...           3 months ago
  • 1.0.4                                ...           3 months ago
  • 1.0.3                                ...           3 months ago
  • 1.0.3-canary.36.691.0                                ...           3 months ago
  • 1.0.3-canary.36.655.0                                ...           3 months ago
  • 1.0.3-canary.38.652.0                                ...           3 months ago
  • 1.0.3-canary.38.640.0                                ...           3 months ago
  • 1.0.2                                ...           3 months ago
  • 1.0.1                                ...           3 months ago
  • 1.0.1-canary.34.593.0                                ...           3 months ago
  • 1.0.1-canary.34.588.0                                ...           3 months ago
  • 1.0.1-canary.34.576.0                                ...           3 months ago
  • 1.0.1-canary.33.575.0                                ...           3 months ago
  • 1.0.0                                ...           3 months ago
  • 0.2.10-canary.31.551.0                                ...           3 months ago
  • 0.2.10-canary.31.546.0                                ...           3 months ago
  • 0.2.9                                ...           4 months ago
  • 0.2.8                                ...           4 months ago
  • 0.2.8-canary.29.499.0                                ...           4 months ago
  • 0.2.8-canary.29.494.0                                ...           4 months ago
  • 0.2.8-canary.29.489.0                                ...           4 months ago
  • 0.2.7                                ...           4 months ago
  • 0.2.7-canary.25.453.0                                ...           4 months ago
  • 0.2.7-canary.27.434.0                                ...           4 months ago
  • 0.2.7-canary.27.422.0                                ...           4 months ago
  • 0.2.7-canary.26.420.0                                ...           4 months ago
  • 0.2.7-canary.28.421.0                                ...           4 months ago
  • 0.2.7-canary.25.419.0                                ...           4 months ago
  • 0.2.6                                ...           4 months ago
  • 0.2.5                                ...           4 months ago
  • 0.2.4                                ...           4 months ago
  • 0.2.3                                ...           4 months ago
  • 0.2.2                                ...           4 months ago
  • 0.2.2-canary.20.352.0                                ...           4 months ago
  • 0.2.1                                ...           4 months ago
  • 0.2.1-canary.19.337.0                                ...           4 months ago
  • 0.2.1-canary.19.332.0                                ...           4 months ago
  • 0.2.1-canary.19.327.0                                ...           4 months ago
  • 0.2.0                                ...           4 months ago
  • 0.1.2                                ...           4 months ago
  • 0.1.2-canary.17.302.0                                ...           4 months ago
  • 0.1.2-canary.18.296.0                                ...           4 months ago
  • 0.2.0-canary.12.285.0                                ...           4 months ago
  • 0.1.2-canary.12.280.0                                ...           4 months ago
  • 0.1.2-canary.12.275.0                                ...           4 months ago
  • 0.1.2-canary.12.269.0                                ...           4 months ago
  • 0.1.2-canary.12.263.0                                ...           4 months ago
  • 0.1.2-canary.12.256.0                                ...           4 months ago
  • 0.1.2-canary.12.250.0                                ...           4 months ago
  • 0.1.2-canary.12.243.0                                ...           4 months ago
  • 0.1.2-canary.12.237.0                                ...           4 months ago
  • 0.1.2-canary.12.231.0                                ...           4 months ago
  • 0.1.2-canary.12.223.0                                ...           4 months ago
  • 0.1.2-canary.12.216.0                                ...           4 months ago
  • 0.1.1                                ...           4 months ago
  • 0.1.0                                ...           4 months ago
  • 0.0.4-canary.12.184.0                                ...           4 months ago
  • 0.0.4-canary.13.179.0                                ...           4 months ago
  • 0.0.4-canary.11.159.0                                ...           4 months ago
  • 0.0.3                                ...           4 months ago
  • 0.0.3-canary.11.151.0                                ...           4 months ago
  • 0.0.3-canary.9.142.0                                ...           4 months ago
  • 0.0.3-canary.9.137.0                                ...           4 months ago
  • 0.0.3-canary.9.128.0                                ...           4 months ago
  • 0.0.3-canary.9.123.0                                ...           4 months ago
  • 0.0.3-canary.9.118.0                                ...           4 months ago
  • 0.0.3-canary.9.99.0                                ...           4 months ago
  • 0.0.3-canary.9.94.0                                ...           4 months ago
  • 0.0.3-canary.9.89.0                                ...           4 months ago
  • 0.0.3-canary.9.84.0                                ...           4 months ago
  • 0.0.2                                ...           4 months ago
  • 0.0.1                                ...           4 months ago
Downloads
Today 2
This Week 131
This Month 274
Last Day 109
Last Week 42
Last Month 121
Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |