Skip to content

🐛 fix(posthog): capture SPA pageviews on history changes - #8

Merged
sudongyuer merged 1 commit into
lobehub:masterfrom
AmAzing129:amazing/fix-posthog-spa-pageview
May 23, 2026
Merged

🐛 fix(posthog): capture SPA pageviews on history changes#8
sudongyuer merged 1 commit into
lobehub:masterfrom
AmAzing129:amazing/fix-posthog-spa-pageview

Conversation

@AmAzing129

Copy link
Copy Markdown
Contributor

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

🔀 Description of Change

  • Default PostHog browser pageview capture to history_change so SPA navigation via the History API emits $pageview events.
  • Preserve explicit caller overrides such as capture_pageview: false.
  • Add focused unit coverage for the default and override behavior.

📝 Additional Information

Validation:

  • pnpm exec vitest run src/providers/posthog.test.ts
  • pnpm exec tsc --noEmit

@pkg-pr-new

pkg-pr-new Bot commented May 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@lobehub/analytics@8

commit: 0ca9a9d

@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@sudongyuer
sudongyuer merged commit 9adee3f into lobehub:master May 23, 2026
7 of 8 checks passed
github-actions Bot pushed a commit that referenced this pull request May 23, 2026
### [Version 1.6.3](v1.6.2...v1.6.3)
<sup>Released on **2026-05-23**</sup>

#### 🐛 Bug Fixes

- **posthog**: Capture SPA pageviews on history changes.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **posthog**: Capture SPA pageviews on history changes, closes [#8](#8) ([9adee3f](9adee3f))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot

Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.6.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants