fix(analytics): make naming, formatting, and consistency better
This commit is contained in:
parent
5ae5cb08ee
commit
9267d0c498
|
@ -1,15 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
const makeEvent = (category) => (eventDetails) => ({
|
||||
const event = (category) => (action, details) => ({
|
||||
category: category,
|
||||
action: eventDetails.action,
|
||||
label: eventDetails.label || undefined,
|
||||
value: eventDetails.value || undefined
|
||||
action: action,
|
||||
label: details.label,
|
||||
value: details.value
|
||||
});
|
||||
|
||||
const buildEvent = makeEvent("build");
|
||||
const configEvent = makeEvent("options");
|
||||
const onBuild = event("build");
|
||||
const onConfig = event("options");
|
||||
|
||||
exports.event = event;
|
||||
exports.onBuild = onBuild;
|
||||
exports.onConfig = onConfig;
|
||||
|
||||
exports.makeEvent = makeEvent;
|
||||
exports.buildEvent = buildEvent;
|
||||
exports.configEvent = configEvent;
|
||||
|
|
|
@ -341,8 +341,7 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
|
|||
var compiler;
|
||||
try {
|
||||
insightReporter.trackEvent(
|
||||
insightEvents.configEvent({
|
||||
action: "options-collected",
|
||||
insightEvents.onConfig("options-collected", {
|
||||
label: JSON.stringify(options),
|
||||
value: 1
|
||||
})
|
||||
|
@ -374,8 +373,7 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
|
|||
}
|
||||
|
||||
insightReporter.trackEvent(
|
||||
insightEvents.buildEvent({
|
||||
action: "build-end",
|
||||
insightEvents.onBuild("build-end", {
|
||||
label: "compiler build end",
|
||||
value: 9999
|
||||
})
|
||||
|
@ -411,8 +409,7 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
|
|||
console.log("\nWebpack is watching the files…\n");
|
||||
} else
|
||||
insightReporter.trackEvent(
|
||||
insightEvents.buildEvent({
|
||||
action: "build-start",
|
||||
insightEvents.onBuild("build-start", {
|
||||
label: "compiler build start",
|
||||
value: 2
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue