@artsy/cohesion
Advanced tools
Comparing version 0.0.4-canary.11.159.0 to 0.0.4-canary.12.184.0
@@ -11,10 +11,12 @@ "use strict"; | ||
/** | ||
* Action fired when an auth form is viewed | ||
* Action fired when a user views an authentication form | ||
* | ||
* @example | ||
* authImpression({ | ||
* contextModule: "header", | ||
* intent: "signup", | ||
* type: "signup", | ||
* }) | ||
* ``` | ||
* authImpression({ | ||
* contextModule: ContextModule.header, | ||
* intent: AuthIntent.viewEditorial, | ||
* type: AuthModalType.signup, | ||
* }) | ||
* ``` | ||
*/ | ||
@@ -21,0 +23,0 @@ const authImpression = ({ |
@@ -6,9 +6,13 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "authImpression", { | ||
enumerable: true, | ||
get: function () { | ||
return _AuthImpression.authImpression; | ||
} | ||
}); | ||
var _AuthImpression = require("./AuthImpression"); | ||
var _AuthImpression = require("./AuthImpression"); | ||
Object.keys(_AuthImpression).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _AuthImpression[key]; | ||
} | ||
}); | ||
}); |
@@ -7,2 +7,9 @@ "use strict"; | ||
exports.ActionType = void 0; | ||
/** | ||
* The top-level actions an Event describes. | ||
* | ||
* Each ActionType corresponds with a table in Redshift. | ||
* @packageDocumentation | ||
*/ | ||
let ActionType; | ||
@@ -9,0 +16,0 @@ exports.ActionType = ActionType; |
@@ -8,16 +8,17 @@ "use strict"; | ||
/* | ||
/** | ||
* Shared schema for authentication events | ||
* @packageDocumentation | ||
*/ | ||
/* | ||
* the component where an auth modal was triggered | ||
/** | ||
* ContextModules where an authentication modal is triggered | ||
*/ | ||
/** | ||
* the type of auth modal displayed | ||
* The type of authentication modal displayed | ||
*/ | ||
let AuthModalType; | ||
/** | ||
* an action taken that prompted the user to signup or login | ||
* An action taken that prompted the user to view an authentication form | ||
*/ | ||
@@ -35,3 +36,3 @@ | ||
/** | ||
* the type of action that opened the auth modal | ||
* The type of action that opened the authentication modal | ||
*/ | ||
@@ -38,0 +39,0 @@ |
@@ -8,4 +8,5 @@ "use strict"; | ||
/* | ||
* the component where an action is triggered | ||
/** | ||
* A component where an action is triggered | ||
* @packageDocumentation | ||
*/ | ||
@@ -12,0 +13,0 @@ let ContextModule; |
@@ -6,51 +6,49 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "ActionType", { | ||
enumerable: true, | ||
get: function () { | ||
return _ActionType.ActionType; | ||
} | ||
}); | ||
Object.defineProperty(exports, "AuthContextModule", { | ||
enumerable: true, | ||
get: function () { | ||
return _Authentication.AuthContextModule; | ||
} | ||
}); | ||
Object.defineProperty(exports, "AuthIntent", { | ||
enumerable: true, | ||
get: function () { | ||
return _Authentication.AuthIntent; | ||
} | ||
}); | ||
Object.defineProperty(exports, "AuthModalType", { | ||
enumerable: true, | ||
get: function () { | ||
return _Authentication.AuthModalType; | ||
} | ||
}); | ||
Object.defineProperty(exports, "AuthTrigger", { | ||
enumerable: true, | ||
get: function () { | ||
return _Authentication.AuthTrigger; | ||
} | ||
}); | ||
Object.defineProperty(exports, "ContextModule", { | ||
enumerable: true, | ||
get: function () { | ||
return _ContextModule.ContextModule; | ||
} | ||
}); | ||
Object.defineProperty(exports, "AuthImpression", { | ||
enumerable: true, | ||
get: function () { | ||
return _Event.AuthImpression; | ||
} | ||
}); | ||
var _ActionType = require("./ActionType"); | ||
Object.keys(_ActionType).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _ActionType[key]; | ||
} | ||
}); | ||
}); | ||
var _Authentication = require("./Authentication"); | ||
Object.keys(_Authentication).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _Authentication[key]; | ||
} | ||
}); | ||
}); | ||
var _ContextModule = require("./ContextModule"); | ||
var _Event = require("./Event"); | ||
Object.keys(_ContextModule).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _ContextModule[key]; | ||
} | ||
}); | ||
}); | ||
var _Event = require("./Event"); | ||
Object.keys(_Event).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _Event[key]; | ||
} | ||
}); | ||
}); |
{ | ||
"name": "@artsy/cohesion", | ||
"version": "0.0.4-canary.11.159.0", | ||
"version": "0.0.4-canary.12.184.0", | ||
"description": "Analytics schema and library helpers", | ||
@@ -19,3 +19,4 @@ "main": "dist/index.js", | ||
"test": "jest", | ||
"type-check": "tsc --noEmit --pretty" | ||
"type-check": "tsc --noEmit --pretty", | ||
"docs": "rm -rf doc && yarn typedoc" | ||
}, | ||
@@ -37,2 +38,3 @@ "devDependencies": { | ||
"tslint": "6.1.1", | ||
"typedoc": "0.17.4", | ||
"typescript": "3.8.3" | ||
@@ -39,0 +41,0 @@ }, |
# Cohesion [![CircleCI](https://circleci.com/gh/artsy/cohesion.svg?style=svg)](https://circleci.com/gh/artsy/cohesion) [![npm version](https://badge.fury.io/js/%40artsy%2Fcohesion.svg)](https://www.npmjs.com/package/@artsy/2Fcohesion) | ||
Artsy's analytics schema & helpers | ||
### Artsy's analytics schema & event helpers | ||
- **State:** In development | ||
- **GitHub:** https://github.com/artsy/cohesion | ||
- **Ci**: https://circleci.com/gh/artsy/cohesion | ||
- **[NPM](https://www.npmjs.com/package/@artsy/2Fcohesion):** Package updates are published automatically on successful merges to master. Canaries are available on PR's from feature branches. | ||
- **Point People**: [@eessex](https://github.com/eessex), [@abhitip](https://github.com/abhitip) | ||
- **Ci**: https://circleci.com/gh/artsy/cohesion | ||
## Contributing | ||
#### Set up: | ||
``` | ||
yarn install | ||
``` | ||
#### Run tests: | ||
``` | ||
yarn test | ||
``` | ||
#### Generate docs: | ||
``` | ||
yarn docs | ||
``` | ||
## 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/Event.ts`. | ||
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/ActionType.ts`, add the name of the new event. This name defines the corresponding downstream table's name in Redshift, and should use the [`lowerCamelCase`](https://wiki.c2.com/?LowerCamelCase) naming convention. | ||
```typescript | ||
// Schema/ActionType.ts | ||
export enum ActionType { | ||
... | ||
myNewEvent = "myNewEvent", | ||
... | ||
} | ||
``` | ||
2. In `Event.ts`, create an interface describing the shape of the new event, as it is recieved in Segment/Redshift. | ||
The `action` key is required and should match the `ActionType` created in step 1. | ||
```typescript | ||
// Schema/Event.ts | ||
export interface MyNewEvent { | ||
action: ActionType.myNewEvent | ||
context_module: ContextModule | ||
optional_property?: string | ||
required_property: number | ||
} | ||
``` | ||
3. If your event uses values not yet in the schema, such as a new `ContextModule`, add new values to existing enums in the Schema directory. | ||
4. 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](https://typedoc.org/guides/doccomments/). | ||
5. PR your changes. Once merged, the schema will be updated and your new event and values will be available to consumers of this package. | ||
6. Data analysts should request an engineer to construct a new event helper for the `/Events` directory (see below). | ||
## Events | ||
The `/Events` 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.ts`. | ||
Engineers should use these helpers whenever sending analtics data to Segment, for example, when creating and analytics event with `react-tracking`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14266
240
84
16