Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swapping posthog-js and posthog-js-lite #183

Open
pauldambra opened this issue Feb 17, 2024 · 10 comments
Open

swapping posthog-js and posthog-js-lite #183

pauldambra opened this issue Feb 17, 2024 · 10 comments
Labels
enhancement New feature or request web

Comments

@pauldambra
Copy link
Member

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 pauldambra added the enhancement New feature or request label Feb 17, 2024
@fromaline
Copy link

@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 👆

@pauldambra
Copy link
Member Author

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

@fromaline
Copy link

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

@fromaline
Copy link

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

@pauldambra
Copy link
Member Author

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

export function getContext(window: Window): any {

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 🙏

@joaovpmamede
Copy link

@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?

@pauldambra
Copy link
Member Author

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' 😊

@fromaline
Copy link

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

@joaovpmamede
Copy link

@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.

@pauldambra
Copy link
Member Author

yep, that's posthog-js only 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web
Projects
None yet
Development

No branches or pull requests

4 participants