Skip to content

Fix PostHog.register TypeError by ensuring execution after window load#3234

Merged
joepavitt merged 2 commits into
mainfrom
posthog-fix
May 9, 2025
Merged

Fix PostHog.register TypeError by ensuring execution after window load#3234
joepavitt merged 2 commits into
mainfrom
posthog-fix

Conversation

@Yndira-E
Copy link
Copy Markdown
Contributor

@Yndira-E Yndira-E commented May 8, 2025

Description

This PR fixes an issue where posthog.register was not recognized as a function. The solution ensures that the code runs only after the window load event, guaranteeing that all resources, including the PostHog library, are fully initialized.

This also updates the PostHog snippet to its most recent version.

This solution can only be tested locally, you need to remove the {%- if not DEV_MODE -%} condition that wraps the last block in the file base.njk

Related Issue(s)

Checklist

  • I have read the contribution guidelines
  • I have considered the performance impact of these changes
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated

@joepavitt joepavitt merged commit c0c7529 into main May 9, 2025
5 checks passed
@joepavitt joepavitt deleted the posthog-fix branch May 9, 2025 07:20
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

Successfully merging this pull request may close these issues.

2 participants