Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
51fd3d2
feat(page-view-tracking-browser): Track page view id in session stora…
Dogfalo Nov 12, 2025
1e762dc
feat(autocapture): add method to get unique element path for element
Dogfalo Oct 29, 2025
45eb74b
wip: scroll and exposure
Dogfalo Nov 24, 2025
6c29cbe
wip: fix test
Dogfalo Nov 24, 2025
6e46cd8
wip: fix exposure test
Dogfalo Nov 24, 2025
387100a
wip: tests
Dogfalo Nov 24, 2025
35c5bf4
wip: prettier and lint
Dogfalo Nov 24, 2025
0da1e8a
wip: add constant for flushing cutoff
Dogfalo Nov 24, 2025
00da5da
wip: add page view tracking id to exposure
Dogfalo Nov 24, 2025
6efd0ce
fix: update tests to add new element path property
Dogfalo Nov 26, 2025
8b7a1de
fix: test coverage
Dogfalo Nov 26, 2025
5c2fc84
fix: double firing behavior
Dogfalo Dec 1, 2025
9774259
fix: test coverage
Dogfalo Dec 1, 2025
720cd5e
fix: import in test
Dogfalo Dec 2, 2025
b985fda
fix(autocapture): add viewport size to scroll to get max X/Y
Dogfalo Dec 23, 2025
5afc08f
fix(autocapture): update exposure timeout and add as an option
Dogfalo Jan 5, 2026
c7eedcb
fix(autocapture): add test for new option
Dogfalo Jan 5, 2026
15118fc
Merge branch 'main' into feat-zoning-alpha
jxiwang Feb 3, 2026
c10a40e
chore: remove yarn
jxiwang Feb 3, 2026
c0a8757
feat(background-capture): adding background capture injection to auto…
jxiwang Jan 20, 2026
6b1bf42
chore: fix rollup
jxiwang Jan 21, 2026
ab54305
chore: update cdn
jxiwang Jan 21, 2026
678ba52
chore: fix yaml
jxiwang Feb 3, 2026
bed0ac5
chore: fix background capture version
jxiwang Feb 3, 2026
d4348cb
chore: fix test migration
jxiwang Feb 3, 2026
201af92
chore: ignore cases for branched sdk
jxiwang Feb 3, 2026
5a184f3
chore: ignore more for branch
jxiwang Feb 3, 2026
6dd358e
chore(release): publish
amplitude-sdk-dev Feb 3, 2026
ffdd304
fix(analytics-browser): handle XHR open vs send race condition (#1541)
daniel-graham-amplitude Feb 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/analytics-browser-test/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ const generatePageViewEventProps = (
'[Amplitude] Page Path': url.pathname,
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': url.href.split('?')[0],
'[Amplitude] Page View ID': uuid,
...(options?.withPageURLEnrichmentProperties
? addPageUrlEnrichmentPreviousPageProperties(url.href, previousUrl.href || '')
: {}),
Expand Down
226 changes: 116 additions & 110 deletions packages/analytics-browser-test/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { default as nock } from 'nock';
import { success } from './responses';
import 'isomorphic-fetch';
import { path, url, SUCCESS_MESSAGE, uuidPattern } from './constants';
import { LogLevel } from '@amplitude/analytics-core';
import { UUID } from '@amplitude/analytics-core';
import { LogLevel, UUID } from '@amplitude/analytics-core';

describe('integration', () => {
const uuid: string = expect.stringMatching(uuidPattern) as string;
Expand Down Expand Up @@ -1953,119 +1952,125 @@ describe('integration', () => {

return new Promise<void>((resolve) => {
setTimeout(() => {
expect(payload).toEqual({
api_key: apiKey,
client_upload_time: event_upload_time,
events: [
{
device_id: uuid,
event_id: 0,
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/about',
'[Amplitude] Page Path': '/about',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/about',
'[Amplitude] Page Counter': 1,
'[Amplitude] Previous Page Location': '',
'[Amplitude] Previous Page Type': 'direct',
try {
expect(payload).toEqual({
api_key: apiKey,
client_upload_time: event_upload_time,
events: [
{
device_id: uuid,
event_id: 0,
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/about',
'[Amplitude] Page Path': '/about',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/about',
'[Amplitude] Page View ID': uuid,
'[Amplitude] Page Counter': 1,
'[Amplitude] Previous Page Location': '',
'[Amplitude] Previous Page Type': 'direct',
},
event_type: '[Amplitude] Page Viewed',
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
event_type: '[Amplitude] Page Viewed',
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
{
device_id: uuid,
event_id: 1,
event_type: 'Event in first session',
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/about',
'[Amplitude] Page Path': '/about',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/about',
'[Amplitude] Previous Page Location': '',
'[Amplitude] Previous Page Type': 'direct',
{
device_id: uuid,
event_id: 1,
event_type: 'Event in first session',
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/about',
'[Amplitude] Page Path': '/about',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/about',
'[Amplitude] Previous Page Location': '',
'[Amplitude] Previous Page Type': 'direct',
},
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
{
device_id: uuid,
event_id: 2,
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/contact',
'[Amplitude] Page Path': '/contact',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/contact',
'[Amplitude] Previous Page Location': 'https://www.example.com/about',
'[Amplitude] Previous Page Type': 'internal',
'[Amplitude] Page Counter': 2,
{
device_id: uuid,
event_id: 2,
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/contact',
'[Amplitude] Page Path': '/contact',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/contact',
'[Amplitude] Page View ID': uuid,
'[Amplitude] Previous Page Location': 'https://www.example.com/about',
'[Amplitude] Previous Page Type': 'internal',
'[Amplitude] Page Counter': 2,
},
event_type: '[Amplitude] Page Viewed',
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
event_type: '[Amplitude] Page Viewed',
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
{
device_id: uuid,
event_id: 3,
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/more',
'[Amplitude] Page Path': '/more',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/more',
'[Amplitude] Page Counter': 1,
'[Amplitude] Previous Page Location': 'https://www.example.com/contact',
'[Amplitude] Previous Page Type': 'internal',
{
device_id: uuid,
event_id: 3,
event_properties: {
'[Amplitude] Page Domain': 'www.example.com',
'[Amplitude] Page Location': 'https://www.example.com/more',
'[Amplitude] Page Path': '/more',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': 'https://www.example.com/more',
'[Amplitude] Page Counter': 1,
'[Amplitude] Page View ID': uuid,
'[Amplitude] Previous Page Location': 'https://www.example.com/contact',
'[Amplitude] Previous Page Type': 'internal',
},
event_type: '[Amplitude] Page Viewed',
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
},
event_type: '[Amplitude] Page Viewed',
insert_id: uuid,
ip: '$remote',
language: 'en-US',
library,
partner_id: undefined,
plan: undefined,
platform: 'Web',
session_id: number,
time: number,
user_agent: userAgent,
user_id: 'user1@amplitude.com',
],
options: {
min_id_length: undefined,
},
],
options: {
min_id_length: undefined,
},
});
scope.done();
});
} finally {
scope.done();
}
resolve();
}, 4000);
});
Expand Down Expand Up @@ -2102,6 +2107,7 @@ describe('integration', () => {
'[Amplitude] Page Path': '',
'[Amplitude] Page Title': '',
'[Amplitude] Page URL': '',
'[Amplitude] Page View ID': uuid,
'[Amplitude] Page Counter': 1,
'[Amplitude] Previous Page Location': '',
'[Amplitude] Previous Page Type': 'direct',
Expand Down
8 changes: 8 additions & 0 deletions packages/analytics-browser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.34.1-feat-zoning-alpha.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-browser@2.34.0...@amplitude/analytics-browser@2.34.1-feat-zoning-alpha.0) (2026-02-03)

**Note:** Version bump only for package @amplitude/analytics-browser





# [2.34.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-browser@2.33.5...@amplitude/analytics-browser@2.34.0) (2026-01-26)


Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This SDK is also available through CDN. Copy the script loader below and paste b
<!-- README_SNIPPET_BLOCK -->
```html
<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})}},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},o=function(e){for(var t=0;t<m.length;t++)i(e,m[t],!1);for(var r=0;r<y.length;r++)i(e,y[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-w6jnsz1UVI8/tE15OISsDGEwBXn+DnL4t6sAQk2CimY5iBtLvv5Ct4i+Hm8mIPmJ",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.34.0-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(c,a);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)n(u,p[l]);r.Identify=u;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],f=0;f<v.length;f++)n(d,v[f]);r.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];o(r),r.createInstance=function(e){return r._iq[e]={_q:[]},o(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[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},i=function(e){for(var t=0;t<y.length;t++)o(e,y[t],!1);for(var r=0;r<g.length;r++)o(e,g[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-Em+bN6B9RH0gMZDyKd93Tvq6WSa1wEURGImQWotiXs2DmcN/D05ZSQE95ZbuHh2C",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.34.1-feat-zoning-alpha.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)n(u,p[l]);r.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],v=0;v<f.length;v++)n(d,f[v]);r.Revenue=d;var y=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();

amplitude.init("<YOUR_API_KEY>");
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
s.parentNode.insertBefore(autoTrackingPluginScript, s);
var as = document.createElement('script');
as.type = 'text/javascript';
as.integrity = 'sha384-w6jnsz1UVI8/tE15OISsDGEwBXn+DnL4t6sAQk2CimY5iBtLvv5Ct4i+Hm8mIPmJ';
as.integrity = 'sha384-Em+bN6B9RH0gMZDyKd93Tvq6WSa1wEURGImQWotiXs2DmcN/D05ZSQE95ZbuHh2C';
as.crossOrigin = 'anonymous';
as.async = false;
as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.34.0-min.js.gz';
as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.34.1-feat-zoning-alpha.0-min.js.gz';
as.onload = function () {
if (!window.amplitude.runQueuedFunctions) {
console.log('[Amplitude] Error: could not load SDK');
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics-browser/generated/amplitude-gtm-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
amplitude.invoked = true;
var as = document.createElement('script');
as.type = 'text/javascript';
as.integrity = 'sha384-7QoPX152N+s8yXqWIZ1tsS6wy+0Y41HcRNGYGVmUPP1Utn+5cUJREu2pOYDu/cvv';
as.integrity = 'sha384-Yv1uxYBttM72z+gWaASG94feHPVlCcA0wiN+84UNWfb6MGh7caMBhsY1YmhnBNw5';
as.crossOrigin = 'anonymous';
as.async = true;
as.src = 'https://cdn.amplitude.com/libs/analytics-browser-gtm-2.34.0-min.js.gz';
as.src = 'https://cdn.amplitude.com/libs/analytics-browser-gtm-2.34.1-feat-zoning-alpha.0-min.js.gz';
as.onload = function () {
if (!window.amplitudeGTM.runQueuedFunctions) {
console.log('[Amplitude] Error: could not load SDK');
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics-browser/generated/amplitude-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
amplitude.invoked = true;
var as = document.createElement('script');
as.type = 'text/javascript';
as.integrity = 'sha384-w6jnsz1UVI8/tE15OISsDGEwBXn+DnL4t6sAQk2CimY5iBtLvv5Ct4i+Hm8mIPmJ';
as.integrity = 'sha384-Em+bN6B9RH0gMZDyKd93Tvq6WSa1wEURGImQWotiXs2DmcN/D05ZSQE95ZbuHh2C';
as.crossOrigin = 'anonymous';
as.async = true;
as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.34.0-min.js.gz';
as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.34.1-feat-zoning-alpha.0-min.js.gz';
as.onload = function () {
if (!window.amplitude.runQueuedFunctions) {
console.log('[Amplitude] Error: could not load SDK');
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplitude/analytics-browser",
"version": "2.34.0",
"version": "2.34.1-feat-zoning-alpha.0",
"description": "Official Amplitude SDK for Web",
"keywords": [
"analytics",
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-browser/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '2.34.0';
export const VERSION = '2.34.1-feat-zoning-alpha.0';
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const removeEventKeyEnrichment = (keysToRemove: KeyOfEvent[] = []): Enric
type: 'enrichment',
setup: async () => undefined,
execute: async (event: Event) => {
for (var key of keysToRemove) {
for (const key of keysToRemove) {
delete event[key];
}
return event;
Expand Down
8 changes: 8 additions & 0 deletions packages/analytics-client-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.4.25-feat-zoning-alpha.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.4.24...@amplitude/analytics-client-common@2.4.25-feat-zoning-alpha.0) (2026-02-03)

**Note:** Version bump only for package @amplitude/analytics-client-common





## [2.4.24](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.4.23...@amplitude/analytics-client-common@2.4.24) (2026-01-26)

**Note:** Version bump only for package @amplitude/analytics-client-common
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-client-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplitude/analytics-client-common",
"version": "2.4.24",
"version": "2.4.25-feat-zoning-alpha.0",
"description": "",
"author": "Amplitude Inc",
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
Expand Down
Loading