@amplitude/analytics-browser
Advanced tools
Comparing version 2.6.2 to 2.6.3-beta.0
import { AmplitudeCore } from '@amplitude/analytics-core'; | ||
import { BrowserClient, BrowserConfig, BrowserOptions, Event, EventOptions, Identify as IIdentify, Revenue as IRevenue, TransportType } from '@amplitude/analytics-types'; | ||
import { WebAttribution } from '@amplitude/analytics-client-common'; | ||
import { BrowserClient, BrowserConfig, BrowserOptions, Event, EventOptions, Identify as IIdentify, Revenue as IRevenue, TransportType, Result } from '@amplitude/analytics-types'; | ||
export declare class AmplitudeBrowser extends AmplitudeCore implements BrowserClient { | ||
@@ -7,2 +8,3 @@ config: BrowserConfig; | ||
previousSessionUserId: string | undefined; | ||
webAttribution: WebAttribution | undefined; | ||
init(apiKey?: string, userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions): import("@amplitude/analytics-types").AmplitudeReturn<void>; | ||
@@ -18,10 +20,11 @@ protected _init(options: BrowserOptions & { | ||
getSessionId(): number | undefined; | ||
setSessionId(sessionId: number): void; | ||
setSessionId(sessionId: number): import("@amplitude/analytics-types").AmplitudeReturn<void> | import("@amplitude/analytics-types").AmplitudeReturn<Result[]>; | ||
extendSession(): void; | ||
setTransport(transport: TransportType): void; | ||
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
revenue(revenue: IRevenue, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
process(event: Event): Promise<import("@amplitude/analytics-types").Result>; | ||
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
revenue(revenue: IRevenue, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
private trackCampaignEventIfNeeded; | ||
process(event: Event): Promise<Result>; | ||
} | ||
//# sourceMappingURL=browser-client.d.ts.map |
@@ -10,3 +10,2 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var config_1 = require("./config"); | ||
var plugin_web_attribution_browser_1 = require("@amplitude/plugin-web-attribution-browser"); | ||
var plugin_page_view_tracking_browser_1 = require("@amplitude/plugin-page-view-tracking-browser"); | ||
@@ -46,3 +45,3 @@ var form_interaction_tracking_1 = require("./plugins/form-interaction-tracking"); | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var browserOptions, connector, attributionTrackingOptions, webAttribution; | ||
var browserOptions, attributionTrackingOptions, connector; | ||
var _this = this; | ||
@@ -61,2 +60,12 @@ return tslib_1.__generator(this, function (_c) { | ||
this.config = browserOptions; | ||
if (!(0, analytics_client_common_1.isAttributionTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 3]; | ||
attributionTrackingOptions = (0, analytics_client_common_1.getAttributionTrackingConfig)(this.config); | ||
this.webAttribution = new analytics_client_common_1.WebAttribution(attributionTrackingOptions, this.config); | ||
// Fetch the current campaign, check if need to track web attribution later | ||
return [4 /*yield*/, this.webAttribution.init()]; | ||
case 2: | ||
// Fetch the current campaign, check if need to track web attribution later | ||
_c.sent(); | ||
_c.label = 3; | ||
case 3: | ||
// Step 3: Set session ID | ||
@@ -69,3 +78,3 @@ // Priority 1: `options.sessionId` | ||
return [4 /*yield*/, _super.prototype._init.call(this, this.config)]; | ||
case 2: | ||
case 4: | ||
_c.sent(); | ||
@@ -77,26 +86,20 @@ connector = (0, analytics_client_common_1.getAnalyticsConnector)(options.instanceName); | ||
}); | ||
if (!(this.config.offline !== analytics_types_1.OfflineDisabled)) return [3 /*break*/, 4]; | ||
if (!(this.config.offline !== analytics_types_1.OfflineDisabled)) return [3 /*break*/, 6]; | ||
return [4 /*yield*/, this.add((0, network_connectivity_checker_1.networkConnectivityCheckerPlugin)()).promise]; | ||
case 3: | ||
_c.sent(); | ||
_c.label = 4; | ||
case 4: return [4 /*yield*/, this.add(new analytics_core_1.Destination()).promise]; | ||
case 5: | ||
_c.sent(); | ||
_c.label = 6; | ||
case 6: return [4 /*yield*/, this.add(new analytics_core_1.Destination()).promise]; | ||
case 7: | ||
_c.sent(); | ||
return [4 /*yield*/, this.add(new context_1.Context()).promise]; | ||
case 6: | ||
case 8: | ||
_c.sent(); | ||
return [4 /*yield*/, this.add(new analytics_client_common_1.IdentityEventSender()).promise]; | ||
case 7: | ||
case 9: | ||
_c.sent(); | ||
// Notify if DET is enabled | ||
(0, det_notification_1.detNotify)(this.config); | ||
if (!(0, analytics_client_common_1.isFileDownloadTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 9]; | ||
if (!(0, analytics_client_common_1.isFileDownloadTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 11]; | ||
return [4 /*yield*/, this.add((0, file_download_tracking_1.fileDownloadTracking)()).promise]; | ||
case 8: | ||
_c.sent(); | ||
_c.label = 9; | ||
case 9: | ||
if (!(0, analytics_client_common_1.isFormInteractionTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 11]; | ||
return [4 /*yield*/, this.add((0, form_interaction_tracking_1.formInteractionTracking)()).promise]; | ||
case 10: | ||
@@ -106,6 +109,4 @@ _c.sent(); | ||
case 11: | ||
if (!(0, analytics_client_common_1.isAttributionTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 13]; | ||
attributionTrackingOptions = (0, analytics_client_common_1.getAttributionTrackingConfig)(this.config); | ||
webAttribution = (0, plugin_web_attribution_browser_1.webAttributionPlugin)(attributionTrackingOptions); | ||
return [4 /*yield*/, this.add(webAttribution).promise]; | ||
if (!(0, analytics_client_common_1.isFormInteractionTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 13]; | ||
return [4 /*yield*/, this.add((0, form_interaction_tracking_1.formInteractionTracking)()).promise]; | ||
case 12: | ||
@@ -172,9 +173,10 @@ _c.sent(); | ||
var _a; | ||
var promises = []; | ||
if (!this.config) { | ||
this.q.push(this.setSessionId.bind(this, sessionId)); | ||
return; | ||
return (0, analytics_core_1.returnWrapper)(Promise.resolve()); | ||
} | ||
// Prevents starting a new session with the same session ID | ||
if (sessionId === this.config.sessionId) { | ||
return; | ||
return (0, analytics_core_1.returnWrapper)(Promise.resolve()); | ||
} | ||
@@ -189,3 +191,3 @@ var previousSessionId = this.getSessionId(); | ||
if (previousSessionId && lastEventTime) { | ||
this.track(constants_1.DEFAULT_SESSION_END_EVENT, undefined, { | ||
promises.push(this.track(constants_1.DEFAULT_SESSION_END_EVENT, undefined, { | ||
device_id: this.previousSessionDeviceId, | ||
@@ -196,13 +198,20 @@ event_id: ++lastEventId, | ||
user_id: this.previousSessionUserId, | ||
}); | ||
}).promise); | ||
} | ||
this.config.lastEventTime = this.config.sessionId; | ||
this.track(constants_1.DEFAULT_SESSION_START_EVENT, undefined, { | ||
event_id: ++lastEventId, | ||
} | ||
// Fire web attribution event when enable webAttribution tracking | ||
// 1. has new campaign (call setSessionId from init function) | ||
// 2. or shouldTrackNewCampaign (call setSessionId from async process(event) when there has new campaign and resetSessionOnNewCampaign = true ) | ||
var isCampaignEventTracked = this.trackCampaignEventIfNeeded(++lastEventId, promises); | ||
if ((0, analytics_client_common_1.isSessionTrackingEnabled)(this.config.defaultTracking)) { | ||
promises.push(this.track(constants_1.DEFAULT_SESSION_START_EVENT, undefined, { | ||
event_id: isCampaignEventTracked ? ++lastEventId : lastEventId, | ||
session_id: this.config.sessionId, | ||
time: this.config.lastEventTime, | ||
}); | ||
}).promise); | ||
} | ||
this.previousSessionDeviceId = this.config.deviceId; | ||
this.previousSessionUserId = this.config.userId; | ||
return (0, analytics_core_1.returnWrapper)(Promise.all(promises)); | ||
}; | ||
@@ -253,15 +262,51 @@ AmplitudeBrowser.prototype.extendSession = function () { | ||
}; | ||
AmplitudeBrowser.prototype.trackCampaignEventIfNeeded = function (lastEventId, promises) { | ||
if (!this.webAttribution || !this.webAttribution.shouldTrackNewCampaign) { | ||
return false; | ||
} | ||
var campaignEvent = this.webAttribution.generateCampaignEvent(lastEventId); | ||
if (promises) { | ||
promises.push(this.track(campaignEvent).promise); | ||
} | ||
else { | ||
this.track(campaignEvent); | ||
} | ||
this.config.loggerProvider.log('Tracking attribution.'); | ||
return true; | ||
}; | ||
AmplitudeBrowser.prototype.process = function (event) { | ||
var _a; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var currentTime, isEventInNewSession; | ||
return tslib_1.__generator(this, function (_a) { | ||
currentTime = Date.now(); | ||
isEventInNewSession = (0, analytics_client_common_1.isNewSession)(this.config.sessionTimeout, this.config.lastEventTime); | ||
if (event.event_type !== constants_1.DEFAULT_SESSION_START_EVENT && | ||
event.event_type !== constants_1.DEFAULT_SESSION_END_EVENT && | ||
(!event.session_id || event.session_id === this.getSessionId()) && | ||
isEventInNewSession) { | ||
this.setSessionId(currentTime); | ||
var currentTime, isEventInNewSession, shouldSetSessionIdOnNewCampaign; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
currentTime = Date.now(); | ||
isEventInNewSession = (0, analytics_client_common_1.isNewSession)(this.config.sessionTimeout, this.config.lastEventTime); | ||
shouldSetSessionIdOnNewCampaign = this.webAttribution && this.webAttribution.shouldSetSessionIdOnNewCampaign(); | ||
if (!(event.event_type !== constants_1.DEFAULT_SESSION_START_EVENT && | ||
event.event_type !== constants_1.DEFAULT_SESSION_END_EVENT && | ||
(!event.session_id || event.session_id === this.getSessionId()))) return [3 /*break*/, 3]; | ||
if (!(isEventInNewSession || shouldSetSessionIdOnNewCampaign)) return [3 /*break*/, 2]; | ||
// Reinitialize the web attribution to refetch the current campaign in the new session | ||
// if the campaign changed without a page reload (SPA's run into this scenario). | ||
return [4 /*yield*/, ((_a = this.webAttribution) === null || _a === void 0 ? void 0 : _a.init())]; | ||
case 1: | ||
// Reinitialize the web attribution to refetch the current campaign in the new session | ||
// if the campaign changed without a page reload (SPA's run into this scenario). | ||
_b.sent(); | ||
this.setSessionId(currentTime); | ||
if (shouldSetSessionIdOnNewCampaign) { | ||
this.config.loggerProvider.log('Created a new session for new campaign.'); | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
if (!isEventInNewSession) { | ||
// Web attribution should be tracked during the middle of a session | ||
// if there has been a chance in the campaign information. | ||
this.trackCampaignEventIfNeeded(); | ||
} | ||
_b.label = 3; | ||
case 3: return [2 /*return*/, _super.prototype.process.call(this, event)]; | ||
} | ||
return [2 /*return*/, _super.prototype.process.call(this, event)]; | ||
}); | ||
@@ -268,0 +313,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.6.2"; | ||
export declare const VERSION = "2.6.3-beta.0"; | ||
//# sourceMappingURL=version.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '2.6.2'; | ||
exports.VERSION = '2.6.3-beta.0'; | ||
//# sourceMappingURL=version.js.map |
import { AmplitudeCore } from '@amplitude/analytics-core'; | ||
import { BrowserClient, BrowserConfig, BrowserOptions, Event, EventOptions, Identify as IIdentify, Revenue as IRevenue, TransportType } from '@amplitude/analytics-types'; | ||
import { WebAttribution } from '@amplitude/analytics-client-common'; | ||
import { BrowserClient, BrowserConfig, BrowserOptions, Event, EventOptions, Identify as IIdentify, Revenue as IRevenue, TransportType, Result } from '@amplitude/analytics-types'; | ||
export declare class AmplitudeBrowser extends AmplitudeCore implements BrowserClient { | ||
@@ -7,2 +8,3 @@ config: BrowserConfig; | ||
previousSessionUserId: string | undefined; | ||
webAttribution: WebAttribution | undefined; | ||
init(apiKey?: string, userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions): import("@amplitude/analytics-types").AmplitudeReturn<void>; | ||
@@ -18,10 +20,11 @@ protected _init(options: BrowserOptions & { | ||
getSessionId(): number | undefined; | ||
setSessionId(sessionId: number): void; | ||
setSessionId(sessionId: number): import("@amplitude/analytics-types").AmplitudeReturn<void> | import("@amplitude/analytics-types").AmplitudeReturn<Result[]>; | ||
extendSession(): void; | ||
setTransport(transport: TransportType): void; | ||
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
revenue(revenue: IRevenue, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
process(event: Event): Promise<import("@amplitude/analytics-types").Result>; | ||
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
revenue(revenue: IRevenue, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
private trackCampaignEventIfNeeded; | ||
process(event: Event): Promise<Result>; | ||
} | ||
//# sourceMappingURL=browser-client.d.ts.map |
import { __assign, __awaiter, __extends, __generator } from "tslib"; | ||
import { AmplitudeCore, Destination, Identify, returnWrapper, Revenue, UUID } from '@amplitude/analytics-core'; | ||
import { getAnalyticsConnector, getAttributionTrackingConfig, getPageViewTrackingConfig, IdentityEventSender, isAttributionTrackingEnabled, isSessionTrackingEnabled, isFileDownloadTrackingEnabled, isFormInteractionTrackingEnabled, setConnectorDeviceId, setConnectorUserId, isNewSession, isPageViewTrackingEnabled, } from '@amplitude/analytics-client-common'; | ||
import { getAnalyticsConnector, getAttributionTrackingConfig, getPageViewTrackingConfig, IdentityEventSender, isAttributionTrackingEnabled, isSessionTrackingEnabled, isFileDownloadTrackingEnabled, isFormInteractionTrackingEnabled, setConnectorDeviceId, setConnectorUserId, isNewSession, isPageViewTrackingEnabled, WebAttribution, } from '@amplitude/analytics-client-common'; | ||
import { OfflineDisabled, } from '@amplitude/analytics-types'; | ||
@@ -8,3 +8,2 @@ import { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper'; | ||
import { useBrowserConfig, createTransport } from './config'; | ||
import { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser'; | ||
import { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-browser'; | ||
@@ -44,3 +43,3 @@ import { formInteractionTracking } from './plugins/form-interaction-tracking'; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var browserOptions, connector, attributionTrackingOptions, webAttribution; | ||
var browserOptions, attributionTrackingOptions, connector; | ||
var _this = this; | ||
@@ -59,2 +58,12 @@ return __generator(this, function (_c) { | ||
this.config = browserOptions; | ||
if (!isAttributionTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 3]; | ||
attributionTrackingOptions = getAttributionTrackingConfig(this.config); | ||
this.webAttribution = new WebAttribution(attributionTrackingOptions, this.config); | ||
// Fetch the current campaign, check if need to track web attribution later | ||
return [4 /*yield*/, this.webAttribution.init()]; | ||
case 2: | ||
// Fetch the current campaign, check if need to track web attribution later | ||
_c.sent(); | ||
_c.label = 3; | ||
case 3: | ||
// Step 3: Set session ID | ||
@@ -67,3 +76,3 @@ // Priority 1: `options.sessionId` | ||
return [4 /*yield*/, _super.prototype._init.call(this, this.config)]; | ||
case 2: | ||
case 4: | ||
_c.sent(); | ||
@@ -75,26 +84,20 @@ connector = getAnalyticsConnector(options.instanceName); | ||
}); | ||
if (!(this.config.offline !== OfflineDisabled)) return [3 /*break*/, 4]; | ||
if (!(this.config.offline !== OfflineDisabled)) return [3 /*break*/, 6]; | ||
return [4 /*yield*/, this.add(networkConnectivityCheckerPlugin()).promise]; | ||
case 3: | ||
_c.sent(); | ||
_c.label = 4; | ||
case 4: return [4 /*yield*/, this.add(new Destination()).promise]; | ||
case 5: | ||
_c.sent(); | ||
_c.label = 6; | ||
case 6: return [4 /*yield*/, this.add(new Destination()).promise]; | ||
case 7: | ||
_c.sent(); | ||
return [4 /*yield*/, this.add(new Context()).promise]; | ||
case 6: | ||
case 8: | ||
_c.sent(); | ||
return [4 /*yield*/, this.add(new IdentityEventSender()).promise]; | ||
case 7: | ||
case 9: | ||
_c.sent(); | ||
// Notify if DET is enabled | ||
detNotify(this.config); | ||
if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 9]; | ||
if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 11]; | ||
return [4 /*yield*/, this.add(fileDownloadTracking()).promise]; | ||
case 8: | ||
_c.sent(); | ||
_c.label = 9; | ||
case 9: | ||
if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 11]; | ||
return [4 /*yield*/, this.add(formInteractionTracking()).promise]; | ||
case 10: | ||
@@ -104,6 +107,4 @@ _c.sent(); | ||
case 11: | ||
if (!isAttributionTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 13]; | ||
attributionTrackingOptions = getAttributionTrackingConfig(this.config); | ||
webAttribution = webAttributionPlugin(attributionTrackingOptions); | ||
return [4 /*yield*/, this.add(webAttribution).promise]; | ||
if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3 /*break*/, 13]; | ||
return [4 /*yield*/, this.add(formInteractionTracking()).promise]; | ||
case 12: | ||
@@ -170,9 +171,10 @@ _c.sent(); | ||
var _a; | ||
var promises = []; | ||
if (!this.config) { | ||
this.q.push(this.setSessionId.bind(this, sessionId)); | ||
return; | ||
return returnWrapper(Promise.resolve()); | ||
} | ||
// Prevents starting a new session with the same session ID | ||
if (sessionId === this.config.sessionId) { | ||
return; | ||
return returnWrapper(Promise.resolve()); | ||
} | ||
@@ -187,3 +189,3 @@ var previousSessionId = this.getSessionId(); | ||
if (previousSessionId && lastEventTime) { | ||
this.track(DEFAULT_SESSION_END_EVENT, undefined, { | ||
promises.push(this.track(DEFAULT_SESSION_END_EVENT, undefined, { | ||
device_id: this.previousSessionDeviceId, | ||
@@ -194,13 +196,20 @@ event_id: ++lastEventId, | ||
user_id: this.previousSessionUserId, | ||
}); | ||
}).promise); | ||
} | ||
this.config.lastEventTime = this.config.sessionId; | ||
this.track(DEFAULT_SESSION_START_EVENT, undefined, { | ||
event_id: ++lastEventId, | ||
} | ||
// Fire web attribution event when enable webAttribution tracking | ||
// 1. has new campaign (call setSessionId from init function) | ||
// 2. or shouldTrackNewCampaign (call setSessionId from async process(event) when there has new campaign and resetSessionOnNewCampaign = true ) | ||
var isCampaignEventTracked = this.trackCampaignEventIfNeeded(++lastEventId, promises); | ||
if (isSessionTrackingEnabled(this.config.defaultTracking)) { | ||
promises.push(this.track(DEFAULT_SESSION_START_EVENT, undefined, { | ||
event_id: isCampaignEventTracked ? ++lastEventId : lastEventId, | ||
session_id: this.config.sessionId, | ||
time: this.config.lastEventTime, | ||
}); | ||
}).promise); | ||
} | ||
this.previousSessionDeviceId = this.config.deviceId; | ||
this.previousSessionUserId = this.config.userId; | ||
return returnWrapper(Promise.all(promises)); | ||
}; | ||
@@ -251,15 +260,51 @@ AmplitudeBrowser.prototype.extendSession = function () { | ||
}; | ||
AmplitudeBrowser.prototype.trackCampaignEventIfNeeded = function (lastEventId, promises) { | ||
if (!this.webAttribution || !this.webAttribution.shouldTrackNewCampaign) { | ||
return false; | ||
} | ||
var campaignEvent = this.webAttribution.generateCampaignEvent(lastEventId); | ||
if (promises) { | ||
promises.push(this.track(campaignEvent).promise); | ||
} | ||
else { | ||
this.track(campaignEvent); | ||
} | ||
this.config.loggerProvider.log('Tracking attribution.'); | ||
return true; | ||
}; | ||
AmplitudeBrowser.prototype.process = function (event) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var currentTime, isEventInNewSession; | ||
return __generator(this, function (_a) { | ||
currentTime = Date.now(); | ||
isEventInNewSession = isNewSession(this.config.sessionTimeout, this.config.lastEventTime); | ||
if (event.event_type !== DEFAULT_SESSION_START_EVENT && | ||
event.event_type !== DEFAULT_SESSION_END_EVENT && | ||
(!event.session_id || event.session_id === this.getSessionId()) && | ||
isEventInNewSession) { | ||
this.setSessionId(currentTime); | ||
var currentTime, isEventInNewSession, shouldSetSessionIdOnNewCampaign; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
currentTime = Date.now(); | ||
isEventInNewSession = isNewSession(this.config.sessionTimeout, this.config.lastEventTime); | ||
shouldSetSessionIdOnNewCampaign = this.webAttribution && this.webAttribution.shouldSetSessionIdOnNewCampaign(); | ||
if (!(event.event_type !== DEFAULT_SESSION_START_EVENT && | ||
event.event_type !== DEFAULT_SESSION_END_EVENT && | ||
(!event.session_id || event.session_id === this.getSessionId()))) return [3 /*break*/, 3]; | ||
if (!(isEventInNewSession || shouldSetSessionIdOnNewCampaign)) return [3 /*break*/, 2]; | ||
// Reinitialize the web attribution to refetch the current campaign in the new session | ||
// if the campaign changed without a page reload (SPA's run into this scenario). | ||
return [4 /*yield*/, ((_a = this.webAttribution) === null || _a === void 0 ? void 0 : _a.init())]; | ||
case 1: | ||
// Reinitialize the web attribution to refetch the current campaign in the new session | ||
// if the campaign changed without a page reload (SPA's run into this scenario). | ||
_b.sent(); | ||
this.setSessionId(currentTime); | ||
if (shouldSetSessionIdOnNewCampaign) { | ||
this.config.loggerProvider.log('Created a new session for new campaign.'); | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
if (!isEventInNewSession) { | ||
// Web attribution should be tracked during the middle of a session | ||
// if there has been a chance in the campaign information. | ||
this.trackCampaignEventIfNeeded(); | ||
} | ||
_b.label = 3; | ||
case 3: return [2 /*return*/, _super.prototype.process.call(this, event)]; | ||
} | ||
return [2 /*return*/, _super.prototype.process.call(this, event)]; | ||
}); | ||
@@ -266,0 +311,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.6.2"; | ||
export declare const VERSION = "2.6.3-beta.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = '2.6.2'; | ||
export var VERSION = '2.6.3-beta.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},i=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},a=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(i(e,t,Array.prototype.slice.call(arguments)))}}},s=function(e){for(var t=0;t<m.length;t++)a(e,m[t],!1);for(var n=0;n<y.length;n++)a(e,y[n],!0)};n.invoked=!0;var o=t.getElementsByTagName("script")[0],u=t.createElement("script");u.src="https://cdn.amplitude.com/libs/plugin-default-event-tracking-advanced-browser-0.7.2-min.js.gz",u.async=!1,o.parentNode.insertBefore(u,o);var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-QTeYiCpDVq3ksW+s2NZ0GnuzzfHHtNW+WQQjENwaJvD2FKX+MB3RXlcDzIEzZatr",c.crossOrigin="anonymous",c.async=!1,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.6.2-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK"),e.amplitude.init("YOUR_API_KEY","YOUR_USER_ID",{instanceName:"amplitude-bookmarklet",serverZone:"YOUR_SERVER_ZONE",ingestionMetadata:{sourceName:"browser-typescript-bookmarklet",sourceVersion:"1.0.0"},optOut:!1}),amplitudeDefaultEventTrackingAdvancedPlugin&&litudeDefaultEventTrackingAdvancedPlugin.defaultEventTrackingAdvancedPlugin&&"function"==typeof amplitudeDefaultEventTrackingAdvancedPlugin.defaultEventTrackingAdvancedPlugin&&e.amplitude.add(amplitudeDefaultEventTrackingAdvancedPlugin.defaultEventTrackingAdvancedPlugin()),alert("Amplitude is now tracking events!")},o.parentNode.insertBefore(c,o);for(var d=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(d,l[p]);n.Identify=d;for(var v=function(){return this._q=[],this},g=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<g.length;f++)r(v,g[f]);n.Revenue=v;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];s(n),n.createInstance=function(e){return n._iq[e]={_q:[]},s(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},i=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},a=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(i(e,t,Array.prototype.slice.call(arguments)))}}},s=function(e){for(var t=0;t<f.length;t++)a(e,f[t],!1);for(var n=0;n<y.length;n++)a(e,y[n],!0)};n.invoked=!0;var o=t.getElementsByTagName("script")[0],u=t.createElement("script");u.src="https://cdn.amplitude.com/libs/plugin-default-event-tracking-advanced-browser-0.7.2-min.js.gz",u.async=!1,o.parentNode.insertBefore(u,o);var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-Qht2PEamEOgBr0T73d2XgDN5WYZGrhAy2nyMa193Xra/hWrydUQY4qlwK620MTXj",c.crossOrigin="anonymous",c.async=!1,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.6.3-beta.0-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK"),e.amplitude.init("YOUR_API_KEY","YOUR_USER_ID",{instanceName:"amplitude-bookmarklet",serverZone:"YOUR_SERVER_ZONE",ingestionMetadata:{sourceName:"browser-typescript-bookmarklet",sourceVersion:"1.0.0"},optOut:!1}),amplitudeDefaultEventTrackingAdvancedPlugin&&litudeDefaultEventTrackingAdvancedPlugin.defaultEventTrackingAdvancedPlugin&&"function"==typeof amplitudeDefaultEventTrackingAdvancedPlugin.defaultEventTrackingAdvancedPlugin&&e.amplitude.add(amplitudeDefaultEventTrackingAdvancedPlugin.defaultEventTrackingAdvancedPlugin()),alert("Amplitude is now tracking events!")},o.parentNode.insertBefore(c,o);for(var d=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(d,l[p]);n.Identify=d;for(var v=function(){return this._q=[],this},g=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],m=0;m<g.length;m++)r(v,g[m]);n.Revenue=v;var f=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];s(n),n.createInstance=function(e){return n._iq[e]={_q:[]},s(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}(); |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(e,t){var r=e.amplitudeGTM||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t<y.length;t++)i(e,y[t],!1);for(var r=0;r<g.length;r++)i(e,g[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-zw04Xm66huU81ABAABuDKu+K6Sp5lFZLLjqxwGJr6OWvEXQOnarazPHnfyqKIL+/",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-gtm-2.6.2-min.js.gz",u.onload=function(){e.amplitudeGTM.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(u,c);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)n(l,p[d]);r.Identify=l;for(var f=function(){return this._q=[],this},m=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<m.length;v++)n(f,m[v]);r.Revenue=f;var y=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];a(r),r.createInstance=function(e){return r._iq[e]={_q:[]},a(r._iq[e]),r._iq[e]},e.amplitudeGTM=r,e.amplitude||(e.amplitude=e.amplitudeGTM)}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var r=e.amplitudeGTM||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t<g.length;t++)i(e,g[t],!1);for(var r=0;r<y.length;r++)i(e,y[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-+LWEiHJp5bOhqvWlOotVjOU4mwi5e4XjQ9sF50GomCgxS5mS9u/nFHjCoNpLHkxG",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-gtm-2.6.3-beta.0-min.js.gz",u.onload=function(){e.amplitudeGTM.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(u,c);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)n(l,p[d]);r.Identify=l;for(var m=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)n(m,f[v]);r.Revenue=m;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];a(r),r.createInstance=function(e){return r._iq[e]={_q:[]},a(r._iq[e]),r._iq[e]},e.amplitudeGTM=r,e.amplitude||(e.amplitude=e.amplitudeGTM)}}(window,document)}(); |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t<g.length;t++)i(e,g[t],!1);for(var r=0;r<m.length;r++)i(e,m[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-QTeYiCpDVq3ksW+s2NZ0GnuzzfHHtNW+WQQjENwaJvD2FKX+MB3RXlcDzIEzZatr",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.6.2-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(c,u);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)n(l,p[d]);r.Identify=l;for(var f=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],y=0;y<v.length;y++)n(f,v[y]);r.Revenue=f;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];a(r),r.createInstance=function(e){return r._iq[e]={_q:[]},a(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t<g.length;t++)i(e,g[t],!1);for(var r=0;r<m.length;r++)i(e,m[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-Qht2PEamEOgBr0T73d2XgDN5WYZGrhAy2nyMa193Xra/hWrydUQY4qlwK620MTXj",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.6.3-beta.0-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(c,u);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)n(l,p[d]);r.Identify=l;for(var f=function(){return this._q=[],this},y=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<y.length;v++)n(f,y[v]);r.Revenue=f;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];a(r),r.createInstance=function(e){return r._iq[e]={_q:[]},a(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); |
import { AmplitudeCore } from '@amplitude/analytics-core'; | ||
import { BrowserClient, BrowserConfig, BrowserOptions, Event, EventOptions, Identify as IIdentify, Revenue as IRevenue, TransportType } from '@amplitude/analytics-types'; | ||
import { WebAttribution } from '@amplitude/analytics-client-common'; | ||
import { BrowserClient, BrowserConfig, BrowserOptions, Event, EventOptions, Identify as IIdentify, Revenue as IRevenue, TransportType, Result } from '@amplitude/analytics-types'; | ||
export declare class AmplitudeBrowser extends AmplitudeCore implements BrowserClient { | ||
@@ -7,2 +8,3 @@ config: BrowserConfig; | ||
previousSessionUserId: string | undefined; | ||
webAttribution: WebAttribution | undefined; | ||
init(apiKey?: string, userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions): import("@amplitude/analytics-types").AmplitudeReturn<void>; | ||
@@ -18,10 +20,11 @@ protected _init(options: BrowserOptions & { | ||
getSessionId(): number | undefined; | ||
setSessionId(sessionId: number): void; | ||
setSessionId(sessionId: number): import("@amplitude/analytics-types").AmplitudeReturn<void> | import("@amplitude/analytics-types").AmplitudeReturn<Result[]>; | ||
extendSession(): void; | ||
setTransport(transport: TransportType): void; | ||
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
revenue(revenue: IRevenue, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<import("@amplitude/analytics-types").Result>; | ||
process(event: Event): Promise<import("@amplitude/analytics-types").Result>; | ||
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
revenue(revenue: IRevenue, eventOptions?: EventOptions): import("@amplitude/analytics-types").AmplitudeReturn<Result>; | ||
private trackCampaignEventIfNeeded; | ||
process(event: Event): Promise<Result>; | ||
} | ||
//# sourceMappingURL=browser-client.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.6.2"; | ||
export declare const VERSION = "2.6.3-beta.0"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "@amplitude/analytics-browser", | ||
"version": "2.6.2", | ||
"version": "2.6.3-beta.0", | ||
"description": "Official Amplitude SDK for Web", | ||
@@ -47,7 +47,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@amplitude/analytics-client-common": "^2.1.3", | ||
"@amplitude/analytics-client-common": "^2.1.4-beta.0", | ||
"@amplitude/analytics-core": "^2.2.4", | ||
"@amplitude/analytics-types": "^2.5.0", | ||
"@amplitude/plugin-page-view-tracking-browser": "^2.2.6", | ||
"@amplitude/plugin-web-attribution-browser": "^2.1.7", | ||
"@amplitude/plugin-page-view-tracking-browser": "^2.2.7-beta.0", | ||
"tslib": "^2.4.1" | ||
@@ -70,3 +69,3 @@ }, | ||
], | ||
"gitHead": "4820f115b7d250892c1c077242d24f22e329fa9c" | ||
"gitHead": "e55f597fcaed19a1deeb8ec02d8e623593a7b3e8" | ||
} |
@@ -56,3 +56,3 @@ <p align="center"> | ||
<script type="text/javascript"> | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t<g.length;t++)i(e,g[t],!1);for(var r=0;r<m.length;r++)i(e,m[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-QTeYiCpDVq3ksW+s2NZ0GnuzzfHHtNW+WQQjENwaJvD2FKX+MB3RXlcDzIEzZatr",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.6.2-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(c,u);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)n(l,p[d]);r.Identify=l;for(var f=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],y=0;y<v.length;y++)n(f,v[y]);r.Revenue=f;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];a(r),r.createInstance=function(e){return r._iq[e]={_q:[]},a(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t<g.length;t++)i(e,g[t],!1);for(var r=0;r<m.length;r++)i(e,m[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-Qht2PEamEOgBr0T73d2XgDN5WYZGrhAy2nyMa193Xra/hWrydUQY4qlwK620MTXj",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.6.3-beta.0-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(c,u);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)n(l,p[d]);r.Identify=l;for(var f=function(){return this._q=[],this},y=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<y.length;v++)n(f,y[v]);r.Revenue=f;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];a(r),r.createInstance=function(e){return r._iq[e]={_q:[]},a(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
@@ -59,0 +59,0 @@ amplitude.init("<YOUR_API_KEY>"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1245403
5
4454
1