Skip to content

Commit 2c69403

Browse files
committed
loadIntegrations option to enable/disable loading of code for destinations in segment
1 parent af99ba6 commit 2c69403

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

packages/analytics-plugin-segment/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const analytics = Analytics({
118118
| `disableAnonymousTraffic` <br/>_optional_ - boolean| Disable loading segment for anonymous visitors |
119119
| `customScriptSrc` <br/>_optional_ - boolean| Override the Segment snippet url, for loading via custom CDN proxy |
120120
| `integrations` <br/>_optional_ - object| Enable/disable segment destinations https://bit.ly/38nRBj3 |
121+
| `loadIntegrations` <br/>_optional_ - object| Enable/disable loading of code for segment destinations http://bit.ly/4lWjAee |
121122

122123
## Server-side usage
123124

packages/analytics-plugin-segment/src/browser.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const config = {
2121
* @param {boolean} [pluginConfig.disableAnonymousTraffic] - Disable loading segment for anonymous visitors
2222
* @param {boolean} [pluginConfig.customScriptSrc] - Override the Segment snippet url, for loading via custom CDN proxy
2323
* @param {object} [pluginConfig.integrations] - Enable/disable segment destinations https://bit.ly/38nRBj3
24+
* @param {object} [pluginConfig.loadIntegrations] - Enable/disable loading of code for segment destinations http://bit.ly/4lWjAee
2425
* @return {object} Analytics plugin
2526
* @example
2627
*
@@ -177,7 +178,8 @@ function initialize({ config, instance }) {
177178
analytics._loadOptions = e
178179
};
179180
analytics.SNIPPET_VERSION = "4.1.0";
180-
analytics.load(writeKey);
181+
const loadIntegrations = config.loadIntegrations && { integrations: config.loadIntegrations } || undefined;
182+
analytics.load(writeKey, loadIntegrations);
181183
}
182184
}
183185
}();

0 commit comments

Comments
 (0)