@segment/analytics-next
Version:
Analytics Next (aka Analytics 2.0) is the latest version of Segment’s JavaScript SDK - enabling you to send your data to any tool without having to learn, test, or use a new API every time.
28 lines • 742 B
JavaScript
/**
* Stores the global window analytics key
*/
var _globalAnalyticsKey = 'analytics';
/**
* Gets the global analytics/buffer
* @param key name of the window property where the buffer is stored (default: analytics)
* @returns AnalyticsSnippet
*/
export function getGlobalAnalytics() {
return window[_globalAnalyticsKey];
}
/**
* Replaces the global window key for the analytics/buffer object
* @param key key name
*/
export function setGlobalAnalyticsKey(key) {
_globalAnalyticsKey = key;
}
/**
* Sets the global analytics object
* @param analytics analytics snippet
*/
export function setGlobalAnalytics(analytics) {
;
window[_globalAnalyticsKey] = analytics;
}
//# sourceMappingURL=global-analytics-helper.js.map