Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Added action to telemetry payload.
Mike Cao5b1eb8bec276
diff --git a/scripts/postbuild.js b/scripts/postbuild.jsindex 55414dcf3..897480587 100644--- a/scripts/postbuild.js+++ b/scripts/postbuild.js@@ -3,7 +3,7 @@ const { sendTelemetry } = require('./telemetry');async function run() {if (!process.env.DISABLE_TELEMETRY) {- await sendTelemetry();+ await sendTelemetry('build');}}diff --git a/scripts/prestart.js b/scripts/prestart.jsindex 55414dcf3..a13af8552 100644--- a/scripts/prestart.js+++ b/scripts/prestart.js@@ -3,7 +3,7 @@ const { sendTelemetry } = require('./telemetry');async function run() {if (!process.env.DISABLE_TELEMETRY) {- await sendTelemetry();+ await sendTelemetry('start');}}diff --git a/scripts/telemetry.js b/scripts/telemetry.jsindex 6dbc586e2..d938c88be 100644--- a/scripts/telemetry.js+++ b/scripts/telemetry.js@@ -8,7 +8,7 @@ const pkg = require('../package.json');const dest = path.resolve(__dirname, '../.next/cache/umami.json');const url = 'https://telemetry.umami.is/api/collect';-async function sendTelemetry() {+async function sendTelemetry(action) {await fs.ensureFile(dest);let json = {};@@ -19,37 +19,36 @@ async function sendTelemetry() {// Ignore}- if (json.version !== pkg.version) {- const { default: isDocker } = await import('is-docker');- const { default: fetch } = await import('node-fetch');-- await fs.writeJSON(dest, { version: pkg.version });-- const payload = {- version: pkg.version,- node: process.version,- platform: os.platform(),- arch: os.arch(),- os: `${os.type()} (${os.version()})`,- docker: isDocker(),- ci: isCI,- upgrade: json.version || false,- };-- await retry(- async () => {- await fetch(url, {- method: 'post',- cache: 'no-cache',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify(payload),- });- },- { minTimeout: 500, retries: 1, factor: 1 },- ).catch(() => {});- }+ await fs.writeJSON(dest, { version: pkg.version });++ const { default: isDocker } = await import('is-docker');+ const { default: fetch } = await import('node-fetch');++ const payload = {+ action,+ version: pkg.version,+ node: process.version,+ platform: os.platform(),+ arch: os.arch(),+ os: `${os.type()} (${os.version()})`,+ docker: isDocker(),+ ci: isCI,+ upgrade: json.version || false,+ };++ await retry(+ async () => {+ await fetch(url, {+ method: 'post',+ cache: 'no-cache',+ headers: {+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify(payload),+ });+ },+ { minTimeout: 500, retries: 1, factor: 1 },+ ).catch(() => {});}module.exports = {