@amplitude/analytics-browser 2.11.9 → 2.11.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/lib-prefix.d.ts +2 -0
- package/lib/cjs/lib-prefix.d.ts.map +1 -0
- package/lib/cjs/lib-prefix.js +4 -0
- package/lib/cjs/lib-prefix.js.map +1 -0
- package/lib/cjs/plugins/context.d.ts.map +1 -1
- package/lib/cjs/plugins/context.js +2 -1
- package/lib/cjs/plugins/context.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/lib-prefix.d.ts +2 -0
- package/lib/esm/lib-prefix.d.ts.map +1 -0
- package/lib/esm/lib-prefix.js +2 -0
- package/lib/esm/lib-prefix.js.map +1 -0
- package/lib/esm/plugins/context.d.ts.map +1 -1
- package/lib/esm/plugins/context.js +2 -1
- package/lib/esm/plugins/context.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/amplitude-bookmarklet-snippet-min.js +1 -1
- package/lib/scripts/amplitude-bookmarklet.html +1 -1
- package/lib/scripts/amplitude-gtm-min.js +1 -1
- package/lib/scripts/amplitude-gtm-min.js.gz +0 -0
- package/lib/scripts/amplitude-gtm-min.js.map +1 -1
- package/lib/scripts/amplitude-gtm-snippet-min.js +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.js.map +1 -1
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/amplitude-snippet-instructions.html +1 -1
- package/lib/scripts/amplitude-snippet-min.js +1 -1
- package/lib/scripts/lib-prefix.d.ts +2 -0
- package/lib/scripts/lib-prefix.d.ts.map +1 -0
- package/lib/scripts/plugins/context.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/lib/scripts/version.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ This SDK is also available through CDN. Copy the script loader below and paste b
|
|
|
53
53
|
<!-- README_SNIPPET_BLOCK -->
|
|
54
54
|
```html
|
|
55
55
|
<script type="text/javascript">
|
|
56
|
-
!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<m.length;t++)i(e,m[t],!1);for(var r=0;r<g.length;r++)i(e,g[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-
|
|
56
|
+
!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<m.length;t++)i(e,m[t],!1);for(var r=0;r<g.length;r++)i(e,g[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-kLzFn7/5NJ8po8YfUn2eh6zaAO0sz/fCbM7qShbxRFZXEJwPLfPDhpFMcVPwKrXm",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.11.11-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 p=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<l.length;d++)n(p,l[d]);r.Identify=p;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 m=["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.amplitude=r}}(window,document)}();
|
|
57
57
|
|
|
58
58
|
amplitude.init("<YOUR_API_KEY>");
|
|
59
59
|
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-prefix.d.ts","sourceRoot":"","sources":["../../src/lib-prefix.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-prefix.js","sourceRoot":"","sources":["../../src/lib-prefix.ts"],"names":[],"mappings":";;AAAa,QAAA,SAAS,GAAG,cAAc,CAAC","sourcesContent":["export const LIBPREFIX = 'amplitude-ts';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAQhF,qBAAa,OAAQ,YAAW,YAAY;IAC1C,IAAI,SAAuC;IAC3C,IAAI,WAAqB;IAKzB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,SAA6B;;IASpC,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC;IAM1C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;CAkC9C"}
|
|
@@ -4,13 +4,14 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var analytics_core_1 = require("@amplitude/analytics-core");
|
|
5
5
|
var analytics_client_common_1 = require("@amplitude/analytics-client-common");
|
|
6
6
|
var version_1 = require("../version");
|
|
7
|
+
var lib_prefix_1 = require("../lib-prefix");
|
|
7
8
|
var BROWSER_PLATFORM = 'Web';
|
|
8
9
|
var IP_ADDRESS = '$remote';
|
|
9
10
|
var Context = /** @class */ (function () {
|
|
10
11
|
function Context() {
|
|
11
12
|
this.name = '@amplitude/plugin-context-browser';
|
|
12
13
|
this.type = 'before';
|
|
13
|
-
this.library = "
|
|
14
|
+
this.library = "".concat(lib_prefix_1.LIBPREFIX, "/").concat(version_1.VERSION);
|
|
14
15
|
/* istanbul ignore else */
|
|
15
16
|
if (typeof navigator !== 'undefined') {
|
|
16
17
|
this.userAgent = navigator.userAgent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":";;;AACA,4DAAiD;A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AAI,MAAA,IACD,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GACnE,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,GACxE,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAA,qCAAW,GAAE,EAAE,CAAC,GACrE,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,KAChE,SAAS,EAAE,IAAA,qBAAI,GAAE,EACjB,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EACjC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,KACnB,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI;oBACnC,kBAAkB,EAAE;wBAClB,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU;wBACrD,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,aAAa;qBAC5D;iBACF,CAAC,GACC,OAAO,KACV,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,UAAU,EAAE,IAAI,CAAC,SAAS,GAC3B,CAAC;gBACF,sBAAO,KAAK,EAAC;;;KACd;IACH,cAAC;AAAD,CAAC,AA1DD,IA0DC;AA1DY,0BAAO","sourcesContent":["import { BeforePlugin, BrowserConfig, Event } from '@amplitude/analytics-types';\nimport { UUID } from '@amplitude/analytics-core';\nimport { getLanguage } from '@amplitude/analytics-client-common';\nimport { VERSION } from '../version';\nimport { LIBPREFIX } from '../lib-prefix';\n\nconst BROWSER_PLATFORM = 'Web';\nconst IP_ADDRESS = '$remote';\nexport class Context implements BeforePlugin {\n name = '@amplitude/plugin-context-browser';\n type = 'before' as const;\n\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig;\n userAgent: string | undefined;\n library = `${LIBPREFIX}/${VERSION}`;\n\n constructor() {\n /* istanbul ignore else */\n if (typeof navigator !== 'undefined') {\n this.userAgent = navigator.userAgent;\n }\n }\n\n setup(config: BrowserConfig): Promise<undefined> {\n this.config = config;\n\n return Promise.resolve(undefined);\n }\n\n async execute(context: Event): Promise<Event> {\n const time = new Date().getTime();\n const lastEventId = this.config.lastEventId ?? -1;\n const nextEventId = context.event_id ?? lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n\n const event: Event = {\n user_id: this.config.userId,\n device_id: this.config.deviceId,\n session_id: this.config.sessionId,\n time,\n ...(this.config.appVersion && { app_version: this.config.appVersion }),\n ...(this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }),\n ...(this.config.trackingOptions.language && { language: getLanguage() }),\n ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),\n insert_id: UUID(),\n partner_id: this.config.partnerId,\n plan: this.config.plan,\n ...(this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion,\n },\n }),\n ...context,\n event_id: nextEventId,\n library: this.library,\n user_agent: this.userAgent,\n };\n return event;\n }\n}\n"]}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.11.
|
|
1
|
+
export declare const VERSION = "2.11.11";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/cjs/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,YAAY,CAAC"}
|
package/lib/cjs/version.js
CHANGED
package/lib/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["export const VERSION = '2.11.11';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-prefix.d.ts","sourceRoot":"","sources":["../../src/lib-prefix.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-prefix.js","sourceRoot":"","sources":["../../src/lib-prefix.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG,cAAc,CAAC","sourcesContent":["export const LIBPREFIX = 'amplitude-ts';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAQhF,qBAAa,OAAQ,YAAW,YAAY;IAC1C,IAAI,SAAuC;IAC3C,IAAI,WAAqB;IAKzB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,SAA6B;;IASpC,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC;IAM1C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;CAkC9C"}
|
|
@@ -2,13 +2,14 @@ import { __assign, __awaiter, __generator } from "tslib";
|
|
|
2
2
|
import { UUID } from '@amplitude/analytics-core';
|
|
3
3
|
import { getLanguage } from '@amplitude/analytics-client-common';
|
|
4
4
|
import { VERSION } from '../version';
|
|
5
|
+
import { LIBPREFIX } from '../lib-prefix';
|
|
5
6
|
var BROWSER_PLATFORM = 'Web';
|
|
6
7
|
var IP_ADDRESS = '$remote';
|
|
7
8
|
var Context = /** @class */ (function () {
|
|
8
9
|
function Context() {
|
|
9
10
|
this.name = '@amplitude/plugin-context-browser';
|
|
10
11
|
this.type = 'before';
|
|
11
|
-
this.library = "
|
|
12
|
+
this.library = "".concat(LIBPREFIX, "/").concat(VERSION);
|
|
12
13
|
/* istanbul ignore else */
|
|
13
14
|
if (typeof navigator !== 'undefined') {
|
|
14
15
|
this.userAgent = navigator.userAgent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,IAAM,gBAAgB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AAQ,EAAE,gBAAgB,EAAE,CAAC,GACxE,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC,GACrE,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,KAChE,SAAS,EAAE,IAAI,EAAE,EACjB,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EACjC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,KACnB,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI;oBACnC,kBAAkB,EAAE;wBAClB,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU;wBACrD,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,aAAa;qBAC5D;iBACF,CAAC,GACC,OAAO,KACV,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,UAAU,EAAE,IAAI,CAAC,SAAS,GAC3B,CAAC;gBACF,sBAAO,KAAK,EAAC;;;KACd;IACH,cAAC;AAAD,CAAC,AA1DD,IA0DC","sourcesContent":["import { BeforePlugin, BrowserConfig, Event } from '@amplitude/analytics-types';\nimport { UUID } from '@amplitude/analytics-core';\nimport { getLanguage } from '@amplitude/analytics-client-common';\nimport { VERSION } from '../version';\nimport { LIBPREFIX } from '../lib-prefix';\n\nconst BROWSER_PLATFORM = 'Web';\nconst IP_ADDRESS = '$remote';\nexport class Context implements BeforePlugin {\n name = '@amplitude/plugin-context-browser';\n type = 'before' as const;\n\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig;\n userAgent: string | undefined;\n library = `${LIBPREFIX}/${VERSION}`;\n\n constructor() {\n /* istanbul ignore else */\n if (typeof navigator !== 'undefined') {\n this.userAgent = navigator.userAgent;\n }\n }\n\n setup(config: BrowserConfig): Promise<undefined> {\n this.config = config;\n\n return Promise.resolve(undefined);\n }\n\n async execute(context: Event): Promise<Event> {\n const time = new Date().getTime();\n const lastEventId = this.config.lastEventId ?? -1;\n const nextEventId = context.event_id ?? lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n\n const event: Event = {\n user_id: this.config.userId,\n device_id: this.config.deviceId,\n session_id: this.config.sessionId,\n time,\n ...(this.config.appVersion && { app_version: this.config.appVersion }),\n ...(this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }),\n ...(this.config.trackingOptions.language && { language: getLanguage() }),\n ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),\n insert_id: UUID(),\n partner_id: this.config.partnerId,\n plan: this.config.plan,\n ...(this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion,\n },\n }),\n ...context,\n event_id: nextEventId,\n library: this.library,\n user_agent: this.userAgent,\n };\n return event;\n }\n}\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.11.
|
|
1
|
+
export declare const VERSION = "2.11.11";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,YAAY,CAAC"}
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '2.11.
|
|
1
|
+
export var VERSION = '2.11.11';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,SAAS,CAAC","sourcesContent":["export const VERSION = '2.11.11';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";!function(e,t){var
|
|
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})}},o=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<v.length;t++)o(e,v[t],!1);for(var n=0;n<y.length;n++)o(e,y[n],!0)};n.invoked=!0;var u=t.getElementsByTagName("script")[0],a=t.createElement("script");a.src="https://cdn.amplitude.com/libs/plugin-autocapture-browser-0.9.0-min.js.gz",a.async=!1,u.parentNode.insertBefore(a,u);var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-kLzFn7/5NJ8po8YfUn2eh6zaAO0sz/fCbM7qShbxRFZXEJwPLfPDhpFMcVPwKrXm",c.crossOrigin="anonymous",c.async=!1,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.11.11-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}),amplitudeAutocapturePlugin&&litudeAutocapturePlugin.autocapturePlugin&&"function"==typeof amplitudeAutocapturePlugin.autocapturePlugin&&e.amplitude.add(amplitudeAutocapturePlugin.autocapturePlugin()),alert("Amplitude is now tracking events!")},u.parentNode.insertBefore(c,u);for(var p=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<l.length;d++)r(p,l[d]);n.Identify=p;for(var m=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],g=0;g<f.length;g++)r(m,f[g]);n.Revenue=m;var v=["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 @@
|
|
|
1
|
-
javascript:!function()%7B%22use%20strict%22%3B!function(e%2Ct)%7Bvar%
|
|
1
|
+
javascript:!function()%7B%22use%20strict%22%3B!function(e%2Ct)%7Bvar%20n%3De.amplitude%7C%7C%7B_q%3A%5B%5D%2C_iq%3A%7B%7D%7D%3Bif(n.invoked)e.console%26%26console.error%26%26console.error(%22Amplitude%20snippet%20has%20been%20loaded.%22)%3Belse%7Bvar%20r%3Dfunction(e%2Ct)%7Be.prototype%5Bt%5D%3Dfunction()%7Breturn%20this._q.push(%7Bname%3At%2Cargs%3AArray.prototype.slice.call(arguments%2C0)%7D)%2Cthis%7D%7D%2Ci%3Dfunction(e%2Ct%2Cn)%7Breturn%20function(r)%7Be._q.push(%7Bname%3At%2Cargs%3AArray.prototype.slice.call(n%2C0)%2Cresolve%3Ar%7D)%7D%7D%2Co%3Dfunction(e%2Ct%2Cn)%7Be%5Bt%5D%3Dfunction()%7Bif(n)return%7Bpromise%3Anew%20Promise(i(e%2Ct%2CArray.prototype.slice.call(arguments)))%7D%7D%7D%2Cs%3Dfunction(e)%7Bfor(var%20t%3D0%3Bt%3Cv.length%3Bt%2B%2B)o(e%2Cv%5Bt%5D%2C!1)%3Bfor(var%20n%3D0%3Bn%3Cy.length%3Bn%2B%2B)o(e%2Cy%5Bn%5D%2C!0)%7D%3Bn.invoked%3D!0%3Bvar%20u%3Dt.getElementsByTagName(%22script%22)%5B0%5D%2Ca%3Dt.createElement(%22script%22)%3Ba.src%3D%22https%3A%2F%2Fcdn.amplitude.com%2Flibs%2Fplugin-autocapture-browser-0.9.0-min.js.gz%22%2Ca.async%3D!1%2Cu.parentNode.insertBefore(a%2Cu)%3Bvar%20c%3Dt.createElement(%22script%22)%3Bc.type%3D%22text%2Fjavascript%22%2Cc.integrity%3D%22sha384-kLzFn7%2F5NJ8po8YfUn2eh6zaAO0sz%2FfCbM7qShbxRFZXEJwPLfPDhpFMcVPwKrXm%22%2Cc.crossOrigin%3D%22anonymous%22%2Cc.async%3D!1%2Cc.src%3D%22https%3A%2F%2Fcdn.amplitude.com%2Flibs%2Fanalytics-browser-2.11.11-min.js.gz%22%2Cc.onload%3Dfunction()%7Be.amplitude.runQueuedFunctions%7C%7Cconsole.log(%22%5BAmplitude%5D%20Error%3A%20could%20not%20load%20SDK%22)%2Ce.amplitude.init(%22YOUR_API_KEY%22%2C%22YOUR_USER_ID%22%2C%7BinstanceName%3A%22amplitude-bookmarklet%22%2CserverZone%3A%22YOUR_SERVER_ZONE%22%2CingestionMetadata%3A%7BsourceName%3A%22browser-typescript-bookmarklet%22%2CsourceVersion%3A%221.0.0%22%7D%2CoptOut%3A!1%7D)%2CamplitudeAutocapturePlugin%26%26amplitudeAutocapturePlugin.autocapturePlugin%26%26%22function%22%3D%3Dtypeof%20amplitudeAutocapturePlugin.autocapturePlugin%26%26e.amplitude.add(amplitudeAutocapturePlugin.autocapturePlugin())%2Calert(%22Amplitude%20is%20now%20tracking%20events!%22)%7D%2Cu.parentNode.insertBefore(c%2Cu)%3Bfor(var%20p%3Dfunction()%7Breturn%20this._q%3D%5B%5D%2Cthis%7D%2Cl%3D%5B%22add%22%2C%22append%22%2C%22clearAll%22%2C%22prepend%22%2C%22set%22%2C%22setOnce%22%2C%22unset%22%2C%22preInsert%22%2C%22postInsert%22%2C%22remove%22%2C%22getUserProperties%22%5D%2Cd%3D0%3Bd%3Cl.length%3Bd%2B%2B)r(p%2Cl%5Bd%5D)%3Bn.Identify%3Dp%3Bfor(var%20m%3Dfunction()%7Breturn%20this._q%3D%5B%5D%2Cthis%7D%2Cf%3D%5B%22getEventProperties%22%2C%22setProductId%22%2C%22setQuantity%22%2C%22setPrice%22%2C%22setRevenue%22%2C%22setRevenueType%22%2C%22setEventProperties%22%5D%2Cg%3D0%3Bg%3Cf.length%3Bg%2B%2B)r(m%2Cf%5Bg%5D)%3Bn.Revenue%3Dm%3Bvar%20v%3D%5B%22getDeviceId%22%2C%22setDeviceId%22%2C%22getSessionId%22%2C%22setSessionId%22%2C%22getUserId%22%2C%22setUserId%22%2C%22setOptOut%22%2C%22setTransport%22%2C%22reset%22%2C%22extendSession%22%5D%2Cy%3D%5B%22init%22%2C%22add%22%2C%22remove%22%2C%22track%22%2C%22logEvent%22%2C%22identify%22%2C%22groupIdentify%22%2C%22setGroup%22%2C%22revenue%22%2C%22flush%22%5D%3Bs(n)%2Cn.createInstance%3Dfunction(e)%7Breturn%20n._iq%5Be%5D%3D%7B_q%3A%5B%5D%7D%2Cs(n._iq%5Be%5D)%2Cn._iq%5Be%5D%7D%2Ce.amplitude%3Dn%7D%7D(window%2Cdocument)%7D()%3B%0A
|