posthog-js-lite icon indicating copy to clipboard operation
posthog-js-lite copied to clipboard

swapping posthog-js and posthog-js-lite

Open pauldambra opened this issue 1 year ago • 10 comments

When building the toolbar we use shared code from the main posthog app

But we never want to allow posthog-js in the toolbar, just posthog-js-lite

You can't always swap one-for-one because you can't import { posthog } from posthog-js-lite

it'd be cool if you could

pauldambra avatar Feb 17 '24 15:02 pauldambra

@pauldambra, hi! Sorry, maybe it's the wrong place to ask this question, but can I replace posthog-js with posthog-js-lite on the web in production right now?

I only use posthog.identify and posthog.capture, so the "minimal API" from the readme seems enough. I tested already, and it seems to work as expected with no issues. The only thing I had to change is how I import posthog, exactly like you said in your comment 👆

fromaline avatar Apr 25 '24 14:04 fromaline

hey @fromaline yep, we use it in the toolbar... so it should be completely fine

this issue was only about the mismatch in exports that means you can't always swap with no code changes

pauldambra avatar Apr 25 '24 14:04 pauldambra

@pauldambra, got it! Thanks for answering! PostHog is great tool 👍

fromaline avatar Apr 25 '24 14:04 fromaline

Hey @pauldambra! Does posthog-js-lite no longer record the Device Type property? It seems to work in regular posthog-js.

fromaline avatar May 23 '24 11:05 fromaline

Hey, It's best to go through the in-app support flow or ask new questions rather than comment on different issues 😊

posthog-js-lite is a subset of posthog-js - you can see what it gathers here https://github.com/PostHog/posthog-js-lite/blob/e5ccc75f49435e7cf307f9e515aebef79dcc3f8a/posthog-web/src/context.ts#L4

Best to run through the support flow saying what you're observing and what you expect or open a new issue here if you think there's a bug 🙏

pauldambra avatar May 23 '24 11:05 pauldambra

@pauldambra so currently there's no way of enabling toolbar with posthog-js-lite, correct? Is that something that will be added in the near future?

joaovpmamede avatar Jun 11 '24 09:06 joaovpmamede

hey @joaovpmamede, no... posthog-js-lite is a super stripped down library for folk that need to prioritise bundle size over functionality. if we add functionality to it then it's no longer `lite' 😊

pauldambra avatar Jun 11 '24 12:06 pauldambra

@pauldambra, thanks for answering my question! Initially, I missed it

fromaline avatar Jun 11 '24 12:06 fromaline

@pauldambra got it and I really appreciate the work on the "lite" version. We're playing with it exactly because we'd like a smaller bundle size but now we were requested to have heatmaps and that seems to be only possible with the toolbar.

joaovpmamede avatar Jun 11 '24 13:06 joaovpmamede

yep, that's posthog-js only 👍

pauldambra avatar Jun 11 '24 13:06 pauldambra