Início rápido

Crie o client uma vez e acesse logs, exceções e tracking pela mesma instância.

Browser

Analytics, logs e rastreamento de erros. A captura global de erros já vem instalada.

main.ts
import { Dataxamas } from "dataxamas";

const client = new Dataxamas({
  token: "dx_live_xxx",
  websiteId: "your-website-id",
});

// Global error capture is installed automatically.
// Start collecting page views / clicks / scroll / replay:
client.tracking.start();

client.logs.info("App booted", { version: "1.0.0" });

Servidor / Node

Somente logs e rastreamento de erros.

server.ts
import { Dataxamas } from "dataxamas";

const client = new Dataxamas({
  token: "dx_live_xxx",
  websiteId: "your-website-id",
  environment: "production",
  release: "1.0.0",
});

client.logs.success("Payment processed", { amount: 1999 });

try {
  riskyWork();
} catch (error) {
  client.exceptions.captureException(error, { userId: 42 });
}
client.tracking também existe no servidor, mas chamar client.tracking.start() fora do browser lança erro.