posthog-js-lite 3.4.2 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +19 -0
- package/lib/{index.cjs.js → index.cjs} +950 -199
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.ts +661 -350
- package/lib/{index.esm.js → index.mjs} +950 -199
- package/lib/index.mjs.map +1 -0
- package/package.json +3 -3
- package/src/context.ts +1 -1
- package/src/patch.ts +50 -0
- package/src/posthog-web.ts +57 -8
- package/src/types.ts +2 -1
- package/test/posthog-web.spec.ts +193 -2
- package/tsconfig.json +1 -0
- package/lib/index.cjs.js.map +0 -1
- package/lib/index.esm.js.map +0 -1
- package/lib/posthog-core/src/eventemitter.d.ts +0 -8
- package/lib/posthog-core/src/index.d.ts +0 -207
- package/lib/posthog-core/src/lz-string.d.ts +0 -8
- package/lib/posthog-core/src/types.d.ts +0 -133
- package/lib/posthog-core/src/utils.d.ts +0 -15
- package/lib/posthog-core/src/vendor/uuidv7.d.ts +0 -179
- package/lib/posthog-web/index.d.ts +0 -3
- package/lib/posthog-web/src/context.d.ts +0 -1
- package/lib/posthog-web/src/posthog-web.d.ts +0 -16
- package/lib/posthog-web/src/storage.d.ts +0 -10
- package/lib/posthog-web/src/types.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Next
|
|
2
2
|
|
|
3
|
+
# 3.5.1 – 2025-05-06
|
|
4
|
+
|
|
5
|
+
## Fixed
|
|
6
|
+
|
|
7
|
+
1. Fix exported file extensions to work with older Node versions
|
|
8
|
+
|
|
9
|
+
# 3.5.0 – 2025-04-17
|
|
10
|
+
|
|
11
|
+
## Added
|
|
12
|
+
|
|
13
|
+
1. chore: roll out new flag evaluation backend to majority of customers
|
|
14
|
+
|
|
15
|
+
# 3.4.2 - 2025-02-27
|
|
16
|
+
|
|
17
|
+
## Added
|
|
18
|
+
|
|
19
|
+
1. Added `captureHistoryEvents` option to automatically capture navigation events in single-page applications using the History API.
|
|
20
|
+
|
|
21
|
+
## Fixed
|
|
22
|
+
|
|
23
|
+
1. apiKey cannot be empty.
|
|
24
|
+
|
|
3
25
|
# 3.4.2 - 2025-02-27
|
|
4
26
|
|
|
5
27
|
## Fixed
|
package/README.md
CHANGED
|
@@ -72,4 +72,23 @@ posthog.onFeatureFlag('my-feature-flag', (value) => {
|
|
|
72
72
|
// Opt users in or out, persisting across sessions (default is they are opted in)
|
|
73
73
|
posthog.optOut() // Will stop tracking
|
|
74
74
|
posthog.optIn() // Will start tracking
|
|
75
|
+
|
|
76
|
+
## History API Navigation Tracking
|
|
77
|
+
|
|
78
|
+
Single-page applications (SPAs) typically use the History API (`pushState`, `replaceState`) for navigation instead of full page loads. By default, PostHog only tracks the initial page load.
|
|
79
|
+
|
|
80
|
+
To automatically track navigation events in SPAs, enable the `captureHistoryEvents` option:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const posthog = new PostHog('my-api-key', {
|
|
84
|
+
captureHistoryEvents: true
|
|
85
|
+
})
|
|
75
86
|
```
|
|
87
|
+
|
|
88
|
+
When enabled, PostHog will:
|
|
89
|
+
- Track calls to `history.pushState()` and `history.replaceState()`
|
|
90
|
+
- Track `popstate` events (browser back/forward navigation)
|
|
91
|
+
- Send these as `$pageview` events with the current URL and pathname
|
|
92
|
+
- Include the navigation type (`pushState`, `replaceState`, or `popstate`) as a property
|
|
93
|
+
|
|
94
|
+
This ensures accurate page tracking in modern web applications without requiring manual pageview capture calls.
|