@logicm8/pulse
v0.6.3
Published
Bundled fail-open browser and React analytics SDK for LogicM8 Pulse
Readme
LogicM8 Pulse SDK
Install Pulse at the application-wide browser entry with one npm command:
npx --yes @logicm8/[email protected] i_ABCD-EFGH-JKLMThe short-lived, single-use install code supplies the registered project and
domain without exposing configuration in the command. The packaged CLI detects
the framework and the project's npm, pnpm or Yarn lockfile, pins this SDK as an
application dependency, records every modified file in .pulse-install.json,
and supports --uninstall.
The Pulse SDK contains the fail-open Pulse browser collector for JavaScript and
TypeScript applications. Its collector is bundled with the host application:
it does not create a remote <script> element or load advanced.js. Collection
starts after first paint and never blocks rendering when Pulse is unavailable.
import { initPulse, pulse } from "@logicm8/pulse";
initPulse({ projectKey: "your_project_key" });
void pulse.track("signup_started");React and Next.js applications can mount the client component once at the application root:
import { Pulse } from "@logicm8/pulse/react";
export function App() {
return <Pulse projectKey="your_project_key" />;
}The package is browser-only but safe to import during server rendering.
By default browser events are sent to
https://pulse.logicm8.com/api/analytics/collect. A restrictive Content Security
Policy must allow that URL in connect-src. Applications with a first-party
proxy can set collectEndpoint to a same-origin endpoint instead.
Install the package in the web application source, not in a server-only Worker entry. The Pulse installer locates the application-wide browser entry and adds the import there.
