Skip to content

Commit

Permalink
chore: rename bufferKey to globalAnalyticsKey
Browse files Browse the repository at this point in the history
  • Loading branch information
oscb committed Aug 23, 2023
1 parent 64888dc commit 55f4382
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ describe('Pre-initialization', () => {

;(window as any).segment = [onTrack, track, track2, identify]

await AnalyticsBrowser.standalone(writeKey, { bufferKey: 'segment' })
await AnalyticsBrowser.standalone(writeKey, {
globalAnalyticsKey: 'segment',
})

await sleep(100) // the snippet does not return a promise (pre-initialization) ... it sometimes has a callback as the third argument.
expect(trackSpy).toBeCalledWith('foo')
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/browser/__tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('Initialization', () => {
],
},
{
bufferKey: overrideKey,
globalAnalyticsKey: overrideKey,
}
)
expect.assertions(1)
Expand Down
3 changes: 2 additions & 1 deletion packages/browser/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ async function loadAnalytics(
options: InitOptions = {},
preInitBuffer: PreInitMethodCallBuffer
): Promise<[Analytics, Context]> {
if (options.bufferKey) setGlobalAnalyticsKey(options.bufferKey)
if (options.globalAnalyticsKey)
setGlobalAnalyticsKey(options.globalAnalyticsKey)
// this is an ugly side-effect, but it's for the benefits of the plugins that get their cdn via getCDN()
if (settings.cdnURL) setGlobalCDNUrl(settings.cdnURL)

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/core/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export interface InitOptions {
* Key for the global window property storing the buffered calls
* default: analytics
*/
bufferKey?: string
globalAnalyticsKey?: string
}

/* analytics-classic stubs */
Expand Down

0 comments on commit 55f4382

Please sign in to comment.