analytics-next
analytics-next copied to clipboard
Do not throw error when analytics are disabled.
Imagine the following case where you disable segment in your code.
const { Analytics } = require('@segment/analytics-node'); new Analytics({ writeKey: processe.env.WRITE_KEY || '', disable: true });
If WRITE_KEY is not present, but your analytics are disabled this still throws an error.
This would simplify local setups and do not force them to have a truthy string as write key
🦋 Changeset detected
Latest commit: d25217d4eda3e06dcd06e665afcd939a71ae20ac
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @segment/analytics-node | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@Pruxis Thanks for opening this pull request! I think from a TypeScript perspective writeKey will still be required with this change - @silesky do you think we should update types as well (I think we'd need a tagged union to make this nice) or really just keep this a runtime check?
@Pruxis Thanks for opening this pull request! I think from a TypeScript perspective
writeKeywill still be required with this change - @silesky do you think we should update types as well (I think we'd need a tagged union to make this nice) or really just keep this a runtime check?
Runtime only; no Typescript changes are needed here IMO.
@silesky Do I need to write some tests to get this merged?