PostHog / posthog

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
https://posthog.com
Other
21.23k stars 1.26k forks source link

PostHog event is visible in console log of my next js project. #23423

Open moinCodes opened 3 months ago

moinCodes commented 3 months ago

Bug Description

Bug description

when ever i perform any event it logs it on the browser console. i havent enable debugging mode and this doesnt happen when using react it happens on my nextjs project.

Screenshot 2024-07-03 at 10 35 58 AM

Debug info

No response

pauldambra commented 3 months ago

Hey,

i havent enable debugging mode

the only reason we print those messages is if debug mode is active.

the message is sent here https://github.com/PostHog/posthog-js/blob/main/src/posthog-core.ts#L312 and you can see we always check the current debug state before logging anything https://github.com/PostHog/posthog-js/blob/main/src/utils/logger.ts#L10

So you definitely have debug enabled 😊

there's a few ways that debugmode can be enabled

  1. if you add __posthog_debug=true as a query parameter on the URL
  2. if you have multiple instances and any one of them has debug active
  3. if local storage has ph_debug set to true
  4. if you explicitly pass config debug: true to config on init

there's nothing Next.js specific there

although I can see you're being warned about initializing posthog more than once which can confuse things

we'd need to see your site or your code to give more specific advice though :)