MetricFlow
Loading…
Loading…
Add one call to your site so its metrics and errors show up here.
Only needed for the test button and custom events. Different from the User key. Create it as type "Ingest - License".
// npm i @karan171996/metricflow
// Call init once, when your site starts. In Next.js put this in instrumentation-client.ts.
// If your site already runs its own Sentry, call init after it.
import { init } from '@karan171996/metricflow/browser';
init({
'new-relic': {
browserKey: 'NRJS-xxxxxxxxxxxxxxxxxxx', // replace: New Relic > API keys > Ingest - Browser. Starts NRJS-, NOT your NRAK- User key
applicationId: '123456789', // replace: New Relic > Add data > Browser monitoring. NOT your account ID
accountId: '1234567', // replace: your New Relic account ID
},
sentry: {
dsn: 'https://00000000000000000000000000000000@o0.ingest.sentry.io/0', // replace: Sentry > Project settings > Client Keys (DSN)
},
});// Records a MetricFlowEvent in New Relic. Does nothing before init, and nothing for Sentry.
import { send } from '@karan171996/metricflow/browser';
send('checkout_step', 2, { step: 'payment' });