/ packages / frontend / src / matomo.js
matomo.js
 1  import { getLogger } from "@logtape/logtape";
 2  import { env } from "./utils/env.ts";
 3  const url = env.matomoURL;
 4  
 5  const logger = getLogger(["mass-market", "frontend", "matomo"]);
 6  
 7  if (url) {
 8    logger.debug`loading matomo ${url}`;
 9  
10    const _mtm = globalThis._mtm = globalThis._mtm || [];
11    _mtm.push({ "mtm.startTime": (new Date().getTime()), "event": "mtm.Start" });
12    await import(url);
13  }