Skip to content

Commit db4fefb

Browse files
authored
Merge pull request #2834 from segmentio/revert-2805-documenting-obfuscation-feature
Revert "Bundle Obfuscation [DOC-508]"
2 parents f585da7 + e499ce1 commit db4fefb

File tree

1 file changed

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

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ Destination flags are **case sensitive** and match [the destination's name in th
483483

484484
### Load Options
485485

486+
> info ""
487+
> **Note:** To use this feature, you must be on snippet version 4.1.0 or later. You can get the latest version of the snippet [here](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet).
488+
486489
You can modify the `.load` method in Analytics.js (the second line of the snippet) to take a second argument. If you pass an object with an `integrations` dictionary (matching the format [above](#selecting-destinations-with-the-integrations-object)), then Segment only loads the integrations in that dictionary that are marked as enabled with the boolean value `true`.
487490

488491
You can only call `.load` on page load, or reload (refresh). If you modify the `.load` method between page loads, it does not have any effect until the page is reloaded.
@@ -493,7 +496,15 @@ For example:
493496
analytics.load('writekey', { integrations: { All: false, 'Google Analytics': true, 'Segment.io': true } })
494497
```
495498

496-
#### Bundle Obfuscation
499+
This way, you can conditionally load integrations based on what customers opt into on your site. The example below shows how you might load only the tools that the user agreed to use.
500+
501+
```js
502+
onConsentDialogClosed(function(consentedTools){
503+
analytics.load('writekey', { integrations: consentedTools })
504+
})
505+
```
506+
507+
#### Bundle Obfuscation
497508
You can also add an `obfuscate` property to the object in the second parameter, which obscures the URL from which your integrations and destination actions are loaded. This helps prevent words that are flagged by ad blockers to not be detected in your URL, enabling the integration to properly load.
498509

499510
For example:

0 commit comments

Comments
 (0)