[SOLVED] Has anyone successfully integrated with PostHog for analytics?

I’m using their node.js library and am trying to capture server-side events with:

import { PostHog } from 'posthog-node';

export const posthog = new PostHog(MY_KEY);

  distinctId: userId,
  event: event,
  properties: properties

For some reason, I’m not seeing the events come through. Any ideas?

There’s also a need to call a PostHog shutdown function when the program exits. I’ve tried the following:

process.on('SIGINT', () => {

process.on('exit', () => {

But I don’t see either console.logs when I hit Control + C in the terminal on Mac. Is there a better way to call a function before a Meteor app shuts down?

I’m now seeing server-side events come through. I’m not sure if it was a corrupted npm cache or an update to the posthog-node package.

Still not sure how to call a function when the app shuts down. I’ll spin up a separate topic for that.