Skip to content

Commit ac7823f

Browse files
committed
add disable documentation
1 parent 4ab5811 commit ac7823f

File tree

1 file changed

+12
-0
lines changed
  • src/connections/sources/catalog/libraries/website/javascript

1 file changed

+12
-0
lines changed

src/connections/sources/catalog/libraries/website/javascript/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,18 @@ For example:
577577
analytics.load('writekey', { highEntropyValuesClientHints: ['architecture', 'bitness', 'model', 'platformVersion', 'uaFullVersion', 'fullVersionList', 'wow64'] })
578578
```
579579

580+
#### Disabling
581+
For testing or staging environments, it can be useful to disable your SDK to ensure no events get sent.
582+
If `disable: true` is passed, all analytics method calls will be a no-op, and no network calls will be initiated.
583+
```ts
584+
analytics.load('writekey', { disable: true })
585+
```
586+
587+
For wrapper/plugin authors: if you have an **advanced** use case where you need special access to the CDN Settings (for example, consent management), you can also pass a function. This API will wait for `cdnSettings` to be fetched. Warning: `cdnSettings` is an _unstable_ object.
588+
```ts
589+
analytics.load('writekey', { disable: ({ cdnSettings }) => true })
590+
```
591+
580592
## Retries
581593

582594
When enabled, Analytics.js automatically retries network and server errors. With persistent retries, Analytics.js can:

0 commit comments

Comments
 (0)