@amplitude/analytics-browser
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -10,2 +10,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var campaign_tracker_1 = require("./attribution/campaign-tracker"); | ||
var analytics_connector_1 = require("./utils/analytics-connector"); | ||
var identity_1 = require("./plugins/identity"); | ||
var AmplitudeBrowser = /** @class */ (function (_super) { | ||
@@ -19,3 +21,4 @@ (0, tslib_1.__extends)(AmplitudeBrowser, _super); | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
var oldCookies, browserOptions, isNewSession; | ||
var oldCookies, browserOptions, isNewSession, connector; | ||
var _this = this; | ||
return (0, tslib_1.__generator)(this, function (_d) { | ||
@@ -41,2 +44,10 @@ switch (_d.label) { | ||
} | ||
connector = (0, analytics_connector_1.getAnalyticsConnector)(); | ||
connector.eventBridge.setEventReceiver(function (event) { | ||
void _this.track(event.eventType, event.eventProperties); | ||
}); | ||
connector.identityStore.setIdentity({ | ||
userId: this.config.userId, | ||
deviceId: this.config.deviceId, | ||
}); | ||
// Step 4: Install plugins | ||
@@ -49,5 +60,8 @@ // Do not track any events before this | ||
_d.sent(); | ||
return [4 /*yield*/, this.add(new analytics_core_1.Destination())]; | ||
return [4 /*yield*/, this.add(new identity_1.IdentityEventSender())]; | ||
case 5: | ||
_d.sent(); | ||
return [4 /*yield*/, this.add(new analytics_core_1.Destination())]; | ||
case 6: | ||
_d.sent(); | ||
// Step 5: Set timeline ready for processing events | ||
@@ -61,3 +75,3 @@ // Send existing events, which might be collected by track before init | ||
return [4 /*yield*/, this.runAttributionStrategy(options === null || options === void 0 ? void 0 : options.attribution, isNewSession)]; | ||
case 6: | ||
case 7: | ||
// Step 6: Track attributions | ||
@@ -64,0 +78,0 @@ _d.sent(); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.1.1"; | ||
export declare const VERSION = "1.1.2"; | ||
//# sourceMappingURL=version.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '1.1.1'; | ||
exports.VERSION = '1.1.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -8,2 +8,4 @@ import { __assign, __awaiter, __extends, __generator } from "tslib"; | ||
import { CampaignTracker } from './attribution/campaign-tracker'; | ||
import { getAnalyticsConnector } from './utils/analytics-connector'; | ||
import { IdentityEventSender } from './plugins/identity'; | ||
var AmplitudeBrowser = /** @class */ (function (_super) { | ||
@@ -17,3 +19,4 @@ __extends(AmplitudeBrowser, _super); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var oldCookies, browserOptions, isNewSession; | ||
var oldCookies, browserOptions, isNewSession, connector; | ||
var _this = this; | ||
return __generator(this, function (_d) { | ||
@@ -39,2 +42,10 @@ switch (_d.label) { | ||
} | ||
connector = getAnalyticsConnector(); | ||
connector.eventBridge.setEventReceiver(function (event) { | ||
void _this.track(event.eventType, event.eventProperties); | ||
}); | ||
connector.identityStore.setIdentity({ | ||
userId: this.config.userId, | ||
deviceId: this.config.deviceId, | ||
}); | ||
// Step 4: Install plugins | ||
@@ -47,5 +58,8 @@ // Do not track any events before this | ||
_d.sent(); | ||
return [4 /*yield*/, this.add(new Destination())]; | ||
return [4 /*yield*/, this.add(new IdentityEventSender())]; | ||
case 5: | ||
_d.sent(); | ||
return [4 /*yield*/, this.add(new Destination())]; | ||
case 6: | ||
_d.sent(); | ||
// Step 5: Set timeline ready for processing events | ||
@@ -59,3 +73,3 @@ // Send existing events, which might be collected by track before init | ||
return [4 /*yield*/, this.runAttributionStrategy(options === null || options === void 0 ? void 0 : options.attribution, isNewSession)]; | ||
case 6: | ||
case 7: | ||
// Step 6: Track attributions | ||
@@ -62,0 +76,0 @@ _d.sent(); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.1.1"; | ||
export declare const VERSION = "1.1.2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = '1.1.1'; | ||
export var VERSION = '1.1.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{r.invoked=!0;var n=t.createElement("script");n.type="text/javascript",n.integrity="sha384-XNX6U2ua04l5JNPk8racSkagg14UYkjWQjQmbRhYhLh0rtnEFZ1QTynnf4EUTukV",n.crossOrigin="anonymous",n.async=!0,n.src="https://cdn.amplitude.com/libs/analytics-browser-1.1.1-min.js.gz",n.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var s=t.getElementsByTagName("script")[0];function v(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}}s.parentNode.insertBefore(n,s);for(var o=function(){return this._q=[],this},i=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],a=0;a<i.length;a++)v(o,i[a]);r.Identify=o;for(var u=function(){return this._q=[],this},c=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],l=0;l<c.length;l++)v(u,c[l]);r.Revenue=u;var p=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],d=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];function f(e){function t(t,r){e[t]=function(){var n={promise:new Promise((r=>{e._q.push({name:t,args:Array.prototype.slice.call(arguments,0),resolve:r})}))};if(r)return n}}for(var r=0;r<p.length;r++)t(p[r],!1);for(var n=0;n<d.length;n++)t(d[n],!0)}f(r),e.amplitude=r}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{r.invoked=!0;var n=t.createElement("script");n.type="text/javascript",n.integrity="sha384-bOgag88cCbUrgxz1PjrCwsqjvX4PBHbKsdFMxw6SpeOKRCXcO1Bctvuacd/mRf3r",n.crossOrigin="anonymous",n.async=!0,n.src="https://cdn.amplitude.com/libs/analytics-browser-1.1.2-min.js.gz",n.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var s=t.getElementsByTagName("script")[0];function v(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}}s.parentNode.insertBefore(n,s);for(var o=function(){return this._q=[],this},i=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],a=0;a<i.length;a++)v(o,i[a]);r.Identify=o;for(var c=function(){return this._q=[],this},u=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],p=0;p<u.length;p++)v(c,u[p]);r.Revenue=c;var d=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],l=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];function f(e){function t(t,r){e[t]=function(){var n={promise:new Promise((r=>{e._q.push({name:t,args:Array.prototype.slice.call(arguments,0),resolve:r})}))};if(r)return n}}for(var r=0;r<d.length;r++)t(d[r],!1);for(var n=0;n<l.length;n++)t(l[n],!0)}f(r),e.amplitude=r}}(window,document)}(); |
{ | ||
"name": "@amplitude/analytics-browser", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Official Amplitude SDK for Web", | ||
@@ -44,2 +44,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@amplitude/analytics-connector": "^1.4.5", | ||
"@amplitude/analytics-core": "^0.6.4", | ||
@@ -65,3 +66,3 @@ "@amplitude/analytics-types": "^0.6.1", | ||
], | ||
"gitHead": "15783797c6838763594a004528b1729fb388ad75" | ||
"gitHead": "2698f058d93662642fbccd90686aa23dab1995e4" | ||
} |
@@ -35,3 +35,3 @@ <p align="center"> | ||
<script type="text/javascript"> | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{r.invoked=!0;var n=t.createElement("script");n.type="text/javascript",n.integrity="sha384-XNX6U2ua04l5JNPk8racSkagg14UYkjWQjQmbRhYhLh0rtnEFZ1QTynnf4EUTukV",n.crossOrigin="anonymous",n.async=!0,n.src="https://cdn.amplitude.com/libs/analytics-browser-1.1.1-min.js.gz",n.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var s=t.getElementsByTagName("script")[0];function v(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}}s.parentNode.insertBefore(n,s);for(var o=function(){return this._q=[],this},i=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],a=0;a<i.length;a++)v(o,i[a]);r.Identify=o;for(var u=function(){return this._q=[],this},c=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],l=0;l<c.length;l++)v(u,c[l]);r.Revenue=u;var p=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],d=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];function f(e){function t(t,r){e[t]=function(){var n={promise:new Promise((r=>{e._q.push({name:t,args:Array.prototype.slice.call(arguments,0),resolve:r})}))};if(r)return n}}for(var r=0;r<p.length;r++)t(p[r],!1);for(var n=0;n<d.length;n++)t(d[n],!0)}f(r),e.amplitude=r}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{r.invoked=!0;var n=t.createElement("script");n.type="text/javascript",n.integrity="sha384-bOgag88cCbUrgxz1PjrCwsqjvX4PBHbKsdFMxw6SpeOKRCXcO1Bctvuacd/mRf3r",n.crossOrigin="anonymous",n.async=!0,n.src="https://cdn.amplitude.com/libs/analytics-browser-1.1.2-min.js.gz",n.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var s=t.getElementsByTagName("script")[0];function v(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}}s.parentNode.insertBefore(n,s);for(var o=function(){return this._q=[],this},i=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],a=0;a<i.length;a++)v(o,i[a]);r.Identify=o;for(var c=function(){return this._q=[],this},u=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],p=0;p<u.length;p++)v(c,u[p]);r.Revenue=c;var d=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],l=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];function f(e){function t(t,r){e[t]=function(){var n={promise:new Promise((r=>{e._q.push({name:t,args:Array.prototype.slice.call(arguments,0),resolve:r})}))};if(r)return n}}for(var r=0;r<d.length;r++)t(d[r],!1);for(var n=0;n<l.length;n++)t(l[n],!0)}f(r),e.amplitude=r}}(window,document)}(); | ||
@@ -38,0 +38,0 @@ amplitude.init("YOUR_API_KEY_HERE"); |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
592120
193
5013
5
+ Added@amplitude/analytics-connector@1.6.3(transitive)
+ Added@amplitude/experiment-core@0.11.0(transitive)
+ Addedjs-base64@3.7.7(transitive)