Files
freeCodeCamp/common/app/analytics/index.js
Vasily Belolapotkov decb6eb936 fix(map): Expand map when challenge opened
changed fetchMapUi epic to add extra param - initialNode
added util method to open path in the map by node name
changed action handler for fetchMapUi.complete to open initialNode
changed map component to set scroll on component mount and update
added attribute to challenge component to find challenge node by name
extracted createEventMetaCreator into separate file to break circular
dependencies

Closes #16248
2018-03-04 20:43:10 +03:00

35 lines
862 B
JavaScript

const throwIfUndefined = () => {
throw new TypeError('Argument must not be of type `undefined`');
};
// createEventMetaCreator({
// category: String,
// action: String,
// label?: String,
// value?: Number
// }) => () => Object
export const createEventMetaCreator = ({
// categories are features or namespaces of the app (capitalized):
// Map, Nav, Challenges, and so on
category = throwIfUndefined,
// can be a one word the event
// click, play, toggle.
// This is not a hard and fast rule
action = throwIfUndefined,
// any additional information
// when in doubt use redux action type
// or a short sentence describing the
// action
label,
// used to tack some specific value for a GA event
value
} = throwIfUndefined) => () => ({
analytics: {
type: 'event',
category,
action,
label,
value
}
});