analytics icon indicating copy to clipboard operation
analytics copied to clipboard

feat(issue-506): add loadOptions to segmentPlugin

Open sreenath opened this issue 1 month ago • 1 comments

PR to implement https://github.com/DavidWells/analytics/issues/506

Currently, the Segment plugin initialisation does not allow users to pass the optional second argument, options to the core analytics.load() function. This limits customisation when loading the Segment library.

We request the addition of a new property, loadOptions within the plugin configuration object. This property should accept the desired options object, which will then be passed directly to analytics.load() alongside the writeKey.

Proposed Implementation Change: Instead of the current call:

analytics.load(writeKey);

The plugin should be modified to accept and utilize the loadOptions from the plugin configuration:

const { writeKey, loadOptions } = pluginConfig;
analytics.load(writeKey, loadOptions); // Pass loadOptions as the second argument

sreenath avatar Nov 11 '25 05:11 sreenath

Hey @DavidWells, Kindly review this at your earliest convenience. Thank you.

sreenath avatar Nov 11 '25 22:11 sreenath