Skip to content

Commit 48cdd17

Browse files
Copilotpauldambra
andcommitted
Update JS SDK defaults config date from 2025-05-24 to 2025-11-30
Co-authored-by: pauldambra <984817+pauldambra@users.noreply.github.com>
1 parent e8df036 commit 48cdd17

11 files changed

Lines changed: 12 additions & 12 deletions

File tree

contents/docs/error-tracking/installation/web.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ if (!window.location.host.includes('127.0.0.1') && !window.location.host.include
120120
<details>
121121
<summary>What is the `defaults` option?</summary>
122122

123-
The `defaults` is a date, such as `2025-05-24`, for a configuration snapshot used as defaults to initialize PostHog. This default is overridden when you explicitly set a value for any of the options.
123+
The `defaults` is a date, such as `2025-11-30`, for a configuration snapshot used as defaults to initialize PostHog. This default is overridden when you explicitly set a value for any of the options.
124124

125125
</details>
126126

contents/docs/integrate/_snippets/install-web.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ if (!window.location.host.includes('127.0.0.1') && !window.location.host.include
7979
<details>
8080
<summary>What is the `defaults` option?</summary>
8181

82-
The `defaults` is a date, such as `2025-05-24`, for a configuration snapshot used as defaults to initialize PostHog. This default is overridden when you explicitly set a value for any of the options.
82+
The `defaults` is a date, such as `2025-11-30`, for a configuration snapshot used as defaults to initialize PostHog. This default is overridden when you explicitly set a value for any of the options.
8383

8484
</details>

contents/docs/libraries/angular.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import AngularInstall from "../integrate/_snippets/install-angular.mdx"
3333

3434
## Tracking pageviews
3535

36-
PostHog automatically tracks your pageviews by hooking up to the browser's `navigator` API as long as you initialize PostHog with the `defaults` config option set after `2025-05-24`.
36+
PostHog automatically tracks your pageviews by hooking up to the browser's `navigator` API as long as you initialize PostHog with the `defaults` config option set after `2025-11-30`.
3737

3838
## Capture custom events
3939

contents/docs/libraries/js/config.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Some of the most relevant options are:
3939
| `autocapture`<br/><br/>**Type:** Boolean or AutocaptureConfig<br/>**Default:** `true` | Determines if PostHog should [autocapture](/docs/product-analytics/autocapture) events. This setting does not affect capturing pageview events (see `capture_pageview`). [See below for `AutocaptureConfig`](#configuring-autocapture) |
4040
| `before_send`<br/><br/>**Type:** Function<br/>**Default:** `function () {}` | A function that allows you to amend or reject events before they are sent to PostHog. [See below for more information](/docs/libraries/js/features#amending-or-sampling-events) |
4141
| `bootstrap`<br/><br/>**Type:** Object<br/>**Default:** `{}` | An object containing the `distinctID`, `isIdentifiedID`, and `featureFlags` keys, where `distinctID` is a string, and `featureFlags` is an object of key-value pairs |
42-
| `capture_pageview`<br/><br/>**Type:** Boolean or String<br/>**Default:** `true` | Determines if PostHog should automatically capture pageview events. The default is to capture using page load events. If the special string `history_change` is provided, PostHog will capture pageviews based on path changes by listening to the browser's history API which is useful for single page apps. `history_change` is the default if you choose to set `defaults: '2025-05-24'` or later. |
42+
| `capture_pageview`<br/><br/>**Type:** Boolean or String<br/>**Default:** `true` | Determines if PostHog should automatically capture pageview events. The default is to capture using page load events. If the special string `history_change` is provided, PostHog will capture pageviews based on path changes by listening to the browser's history API which is useful for single page apps. `history_change` is the default if you choose to set `defaults: '2025-11-30'` or later. |
4343
| `capture_pageleave`<br/><br/>**Type:** Boolean<br/>**Default:** `true` | Determines if PostHog should automatically capture pageleave events. |
4444
| `capture_dead_clicks`<br/><br/>**Type:** Boolean<br/>**Default:** `true` | Determines if PostHog should automatically capture dead click events. |
4545
| `cross_subdomain_cookie`<br/><br/>**Type:** Boolean<br/>**Default:** `true` | Determines if cookie should be set on the top level domain (example.com). If `posthog-js` is loaded on a subdomain (`test.example.com`), _and_ `cross_subdomain_cookie` is set to false, it'll set the cookie on the subdomain only (`test.example.com`). |

contents/docs/libraries/next-js/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ The problem with this is that it can cause a [hydration and/or mismatch error](h
187187

188188
### Why did the pageview component need a `useEffect`?
189189

190-
Before updating the JavaScript Web SDK's default behavior when capturing pageviews (`'2025-05-24'`), we suggested using a `useEffect` hook to capture pageviews. This is because it's the simplest way to accurately capture pageviews. Other approaches include:
190+
Before updating the JavaScript Web SDK's default behavior when capturing pageviews (`'2025-11-30'`), we suggested using a `useEffect` hook to capture pageviews. This is because it's the simplest way to accurately capture pageviews. Other approaches include:
191191

192192
1. Not using a `useEffect` hook, but this might lead to duplicate page views being tracked if the component re-renders for reasons other than navigation. It might work depending on your implementation.
193193
2. Using `window.navigation` to track pageviews, but this approach is more complex and is [not supported](https://developer.mozilla.org/en-US/docs/Web/API/Window/navigation) in all browsers.
194194

195-
> **Note:** This approach of manually capturing pageviews is no longer recommended. We recommend using `defaults: '2025-05-24'` or `capture_pageview: 'history_change'` instead, which automatically handles both `$pageview` and `$pageleave` events.
195+
> **Note:** This approach of manually capturing pageviews is no longer recommended. We recommend using `defaults: '2025-11-30'` or `capture_pageview: 'history_change'` instead, which automatically handles both `$pageview` and `$pageleave` events.
196196
>
197197
> If you're still capturing pageviews manually, you should also capture `$pageleave` events to track important engagement metrics like time on page (`$prev_pageview_duration`) and scroll depth (`$prev_pageview_max_scroll_percentage`). To do this, set up a listener on window unload (similar to [how PostHog does it](https://github.com/PostHog/posthog-js/blob/main/packages/browser/src/posthog-core.ts#L644-L646)):
198198
>

contents/handbook/content/docs-style-guide.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ You can use magic placeholders to replace the project API key, project name, app
340340
| `<ph_app_host>` | Your PostHog instance URL | `<ph_app_host>` |
341341
| `<ph_client_api_host>` | Your PostHog client API host | `https://us.i.posthog.com` |
342342
| `<ph_region>` | Your PostHog region (us/eu) | `<ph_region>` |
343-
| `<ph_posthog_js_defaults>` | Default values for posthog-js | `2025-05-24` |
343+
| `<ph_posthog_js_defaults>` | Default values for posthog-js | `2025-11-30` |
344344
| `<ph_proxy_path>` | Your proxy path | `relay-XXXX` (last 4 digits of project API key) |
345345

346346
You can use these placeholders in the code block like this:

contents/tutorials/event-tracking-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Although autocapture is a great way to get started, it can be limiting for more
4141

4242
3. **Customization**. Although it is possible to [add properties to autocapture](/docs/product-analytics/autocapture#capturing-additional-properties-in-autocapture-events), getting exactly the data you want at the exact moment you want requires customization.
4343

44-
4. **Pageviews rely on page loads**. Pageview captures rely on page load events. This means they don't work well with [single-page apps (SPAs)](/tutorials/single-page-app-pageviews). To fix this, you can rely on the [history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to capture pageviews by setting the `capture_pageview` configuration option to `history_change` or by using the most recent `defaults: '2025-05-24'`.
44+
4. **Pageviews rely on page loads**. Pageview captures rely on page load events. This means they don't work well with [single-page apps (SPAs)](/tutorials/single-page-app-pageviews). To fix this, you can rely on the [history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to capture pageviews by setting the `capture_pageview` configuration option to `history_change` or by using the most recent `defaults: '2025-11-30'`.
4545

4646
## Setting up custom events
4747

contents/tutorials/nextjs-analytics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ import posthog from 'posthog-js'
9696

9797
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
9898
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
99-
defaults: '2025-05-24',
99+
defaults: '2025-11-30',
100100
});
101101
```
102102

contents/tutorials/nextjs-pages-analytics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ import posthog from 'posthog-js'
295295

296296
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
297297
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
298-
defaults: '2025-05-24'
298+
defaults: '2025-11-30'
299299
});
300300
```
301301

contents/tutorials/single-page-app-pageviews.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A single-page application (or SPA) dynamically loads content for new pages using
1717

1818
PostHog's JavaScript Web SDK automatically captures pageview events on page load. The problem with SPAs is that **page loads don't happen beyond the initial one**. This means user navigation in your SPA isn't tracked.
1919

20-
Luckily, you can opt-in to tracking this behavior by setting `defaults: '2025-05-24'` when initializing PostHog to use the most recent defaults. This default uses `capture_pageview: 'history_change'`, which captures SPA navigation using the browser [history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API)
20+
Luckily, you can opt-in to tracking this behavior by setting `defaults: '2025-11-30'` when initializing PostHog to use the most recent defaults. This default uses `capture_pageview: 'history_change'`, which captures SPA navigation using the browser [history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API)
2121

2222
This tutorial shows you how to follow the recommended approach for the most popular SPA frameworks like [Next.js](#tracking-pageviews-in-nextjs-app-router), [Vue](#tracking-pageviews-in-vue), [Svelte](#tracking-pageviews-in-svelte), and [Angular](#tracking-pageviews-in-angular).
2323

0 commit comments

Comments
 (0)