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

Popover surveys not showing up when serving bundled posthog with disable_external_dependency_loading set to true #1377

Open
1 of 4 tasks
vonBrax opened this issue Aug 22, 2024 · 0 comments

Comments

@vonBrax
Copy link

vonBrax commented Aug 22, 2024

Bug description

When using the JavaScript Web SDK and bundling the posthog dependencies as described in the docs, the popover surveys are not showing up when they should.

The survey is correctly configured in Posthog without any display conditions, and it was also never dismissed by the user (or shown).

As far as I could debug this issue, the problem seems to be that the line

this._surveyManager = assignableWindow.extendPostHogWithSurveys(this.instance)
is never executed because of the check for the surveysGenerator on line
if (!this.instance.config.disable_surveys && this._decideServerResponse && !surveysGenerator) {
, which is set here
;(window as any).extendPostHogWithSurveys = generateSurveys
and executed when the bundled file is loaded in the browser.

I could workaround the issue by patching the surveys.instance._surveyManager variable with:

posthog.surveys._surveyManager =  window.extendPostHogWithSurveys(posthog.surveys.instance);

After the above line is executed, the survey popover immediatelly shows up.

If this affects the front-end, screenshots would be of great help.

--

If you are on PostHog Cloud it would be really valuable if you can share any links where the problem occurs. This speeds up our ability to troubleshoot tremendously.

--

How to reproduce

  1. Create popover survey and launch it
  2. Create an frontend application using the bundled posthog as described in the docs.
  3. Call posthog.init passing true to disable_external_dependency_loading

Environment

  • PostHog Cloud US, project ID: [please provide from https://us.posthog.com/settings/project-details#variables]
  • PostHog Cloud EU, project ID: [please provide from https://eu.posthog.com/settings/project-details#variables]
  • PostHog Hobby self-hosted with docker compose, version/commit: [please provide]
  • PostHog self-hosted with Kubernetes (deprecated, see "Sunsetting Kubernetes support"), version/commit: [please provide]

Additional context

We are using posthog in our frontend application built using Nuxt

Thank you for your bug report – we love squashing them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant