Skip to content

Commit bc05912

Browse files
committed
Revert "Revert "add disable documentation""
This reverts commit 1ca13ea.
1 parent ccad90a commit bc05912

File tree

1 file changed

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

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,21 @@ For example:
564564
analytics.load('writekey', { highEntropyValuesClientHints: ['architecture', 'bitness', 'model', 'platformVersion', 'uaFullVersion', 'fullVersionList', 'wow64'] })
565565
```
566566

567+
#### Disabling
568+
For testing or staging environments, it can be useful to disable your SDK to ensure no events send.
569+
570+
If `disable: true` is passed, all analytics method calls will be a no-op, and no network calls will be initiated.
571+
572+
```ts
573+
analytics.load('writekey', { disable: true })
574+
```
575+
576+
For wrapper/plugin authors: if you have a use case where you need special access to the CDN Settings (for example, consent management), you can also pass a function. This API waits for `cdnSettings` to be fetched. Keep in mind that `cdnSettings` is an _unstable_ object.
577+
578+
```ts
579+
analytics.load('writekey', { disable: (cdnSettings) => true })
580+
```
581+
567582
## Retries
568583

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

0 commit comments

Comments
 (0)