Skip to content

feat: sync Rokt kit with upstream 1.30.1 — page-view capture as page_events - #1307

Open
rmi22186 wants to merge 35 commits into
workstation/3.0-release-3from
feat/rokt-kit-upstream-sync
Open

feat: sync Rokt kit with upstream 1.30.1 — page-view capture as page_events#1307
rmi22186 wants to merge 35 commits into
workstation/3.0-release-3from
feat/rokt-kit-upstream-sync

Conversation

@rmi22186

@rmi22186 rmi22186 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Ports the Rokt kit changes shipped upstream in mparticle-javascript-integration-rokt since the monorepo's 1.28.3 snapshot (PR #1300), bringing kits/rokt up to v1.30.1:

  • v1.29.0 — feat: prevent caching of active_time_on_site_ms attribute (#106): adds active_time_on_site_ms to the selectPlacements attribute-persistence deny list so it is forwarded on the current call but never cached and re-sent stale.
  • v1.30.0 — feat: capture page views and surface as page_events in selectPlacements (#109): captures PageView events into kit-owned localStorage (query params stripped, capped at 25, cleared on session end and when noTargeting is set) and sends them as a JSON page_events attribute on selectPlacements.
  • v1.30.1 — refactor: rename timeOnPage to activeTimeOnPage in selectPlacements page_events (#110).

Files changed

  • src/Rokt-Kit.ts, src/selectPlacementsAttributePersistence.ts, test/src/tests.spec.ts, CHANGELOG.md — taken wholesale from upstream main (no upstream changes conflicted with monorepo adaptations).
  • package.json / package-lock.json — version bump 1.28.3 → 1.30.1 only.
  • vite.config.ts — adds test.execArgv: ['--no-experimental-webstorage'] (see below).

Preserved monorepo adaptations

  • package.json: repository URL, @mparticle/web-sdk in peerDependencies (^3.0.0) + devDependencies (^2.73.1), semantic-release devDependencies removed.
  • vite.config.ts: @mparticle/web-sdk kept external in builds, process.env.PACKAGE_VERSION define, test aliases to monorepo internal types and dist/mparticle.common.js.
  • tsconfig.json: baseUrl/paths mapping for @mparticle/web-sdk/internal.

New: Node >= 25 test-environment fix

The new upstream page-view tests rely on window.localStorage. On Node >= 25, Node's experimental webstorage defines a localStorage global that is undefined without --localstorage-file, and its presence makes Vitest's jsdom environment skip installing jsdom's working implementation — 18 tests fail (upstream has the same failure locally on Node 26; its CI pins Node 24, while this repo's kit-test CI job uses node-version: latest). Fixed by passing --no-experimental-webstorage to the Vitest workers via test.execArgv so jsdom's Storage is used on any Node version.

Test plan

  • npm ci in kits/rokt — clean install from the committed lock file
  • npm run build — iife/cjs/esm bundles + d.ts build successfully
  • npm test — 228/228 tests pass on Node 26.5.0 (CI-like latest) and Node 24.19.0 (upstream-pinned)

nickolas-dimitrakas and others added 30 commits July 29, 2026 14:24
* feat: migrate amplitude

* formatting

* added job to build and run kit tests

* align pull request workflow

* slight pull request needs adjustments

* add kits to release process

* add homepage url

* Revert "slight pull request needs adjustments"

This reverts commit aaf8416.

* reuse mockhttprequest from root

* address @alexs-mparticle comments

* add mparticle core dependency

* only use root .gitignore

* use root prettier

* inherit from root eslintrc

* cleanup kit directory readme

* restore original readme

* peerDependency already states mP Core

* cleanup matrix

* update to kit track package name

* adjust semantic release to update kit versions in lock step

* pass proper commit sha

* unique artifact names and align jest matrix

* add cleanup step for deleting release branch

* publish kits upon success of core and fix issues in implementation

* Configure dependabot for amplitude kit track

* Update kits/README.md

Co-authored-by: Robert Ing <rmi22186@gmail.com>

* run format to fix ci

* add canonical repo chart in readme

* addressed @rmi22186 comments

---------

Co-authored-by: Robert Ing <rmi22186@gmail.com>
* feat: migrate OneTrust kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to onetrust kit

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Intercom kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to intercom kit

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Optimizely kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to optimizely kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Criteo kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to criteo kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate SimpleReach kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to simplereach kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Dynamic Yield kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to dynamic-yield kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Google Tag Manager kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to google-tag-manager kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Rokt kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to rokt kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Heap kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to heap kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Inspectlet kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to inspectlet kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate KissMetrics kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to kissmetrics kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate DoubleClick kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to doubleclick kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Adwords kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to adwords kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Facebook kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to facebook kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Taplytics kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to taplytics kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Bing Ads kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to bingads kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Adobe Target kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to adobe-target kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Twitter kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to twitter kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Device Match kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to device-match kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-localytics-4 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-id5-1 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-leanplum-1 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-mixpanel-2 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-braze-3 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-braze-4 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-braze-5 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate adobe kit to monorepo

Migrates mparticle-javascript-integration-adobe into the web SDK
monorepo under kits/adobe/.

The Adobe kit uses a repo-level build and test orchestration — the
root rollup.config.js concatenates AdobeSDKs vendor files with each
package's source before bundling, and tests run from the root using
Jest with MODULE env vars. The full repo structure is preserved under
kits/adobe/ to keep this working correctly.

Structure:
- kits/adobe/packages/AdobeClient  (@mparticle/web-adobe-client-kit v2.1.3)
- kits/adobe/packages/AdobeServer  (@mparticle/web-adobe-server-kit v2.1.2)
- kits/adobe/HeartbeatKit
- kits/adobe/AdobeSDKs             (VisitorAPI.js, AppMeasurement.js)
- kits/adobe/test                  (Jest tests for client + server)
- Updated package.json repository field to point to monorepo
- Added kits/adobe to kits/matrix.json for CI coverage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): exclude adobe vendor files from prettier and kit tests from jest

- Add kits/adobe/AdobeSDKs/ and babel.config.js to .prettierignore to
  exclude third-party vendor files from formatting checks
- Add testPathIgnorePatterns to jest.config.js to prevent root jest
  runner from picking up kit test files (kits use karma, not jest)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): create dist directories before build in adobe kit

Fresh git checkouts don't include empty dist/ directories (git doesn't
track empty directories and .gitignore excludes dist/). Add mkdir -p to
the build:client:* and build:server:* scripts so the build succeeds
in a clean CI environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): add missing suffix to adobe server kit test config

Server kit registers with suffix 'Server' creating key 'Adobe-Server'
in mParticle's forwarder constructors map. Without suffix: 'Server' in
the test kitConfig, configureUIEnabledKit cannot match the constructor
and initForwarder is never called, causing all integration tests to fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(jest): narrow testPathIgnorePatterns to kits/adobe only

Previously excluded all kits/ which was overly broad. Only the Adobe
kit uses Jest (with test.js / server.test.js filenames that match
Jest's default testMatch). Other kits use Karma and name their files
tests.js (plural), so they don't need an explicit exclusion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(jest): remove redundant node_modules from testPathIgnorePatterns

Jest ignores node_modules by default; the explicit entry was unnecessary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(adobe): align prettier config with root, add eslintrc root flag

- Remove kits/adobe/.prettierrc so Adobe inherits root prettier settings.
  Only difference was trailingComma: "none" vs root's "es5"; Adobe source
  files reformatted accordingly (trailing commas added, no logic changes).
- Update .prettierignore: remove kits/adobe/babel.config.js (no longer
  needed once trailing comma conflict is resolved); keep AdobeSDKs/ vendor
  exclusion.
- Add "root": true to kits/adobe/.eslintrc to prevent ESLint from walking
  up to root config when run from within the kit directory.

Part of ongoing effort to consolidate all configs at the repo root.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate google-analytics-4 kit to monorepo

Migrates GA4Client and GA4Server packages from
mparticle-javascript-integration-google-analytics-4 into the web SDK
monorepo under kits/google-analytics-4/.

- kits/google-analytics-4/ga4-client (@mparticle/web-google-analytics-4-client-kit v1.5.1)
- kits/google-analytics-4/ga4-server (@mparticle/web-google-analytics-4-server-kit v1.0.3)
- Updated package.json repository fields to point to monorepo
- Added both kits to kits/matrix.json for CI coverage
- Applied Prettier formatting to match monorepo code style conventions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): add missing karma devDependencies to ga4-server

The test script calls karma but karma was missing from devDependencies.
Add karma and browser launcher packages to match the ga4-client kit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): regenerate ga4-server package-lock.json with karma deps

Updating package-lock.json to include karma and browser launcher
packages added in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): pin chai to v4 for karma-chai compatibility in ga4-server

karma-chai@0.1.0 requires chai v4's browser bundle at chai/chai.js.
chai v6 changed its file structure, breaking that path. Pinning
chai to ^4.2.0 restores the expected bundle location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ga4): restore correct kit structure and consolidate matrix entry

The original mparticle-javascript-integration-google-analytics-4 repo
used a packages/GA4Client + packages/GA4Server layout with a root
package.json orchestrator. The migration commit incorrectly flattened
this to ga4-client/ and ga4-server/ at the top level and omitted the
root package.json.

This commit:
- Moves ga4-client/ → packages/GA4Client/ (git mv, history preserved)
- Moves ga4-server/ → packages/GA4Server/ (git mv, history preserved)
- Updates repository.directory in each sub-kit's package.json
- Adds root package.json with build/test scripts that delegate to each
  sub-package via npm --prefix
- Adds root package-lock.json (no root deps; required for npm ci)
- Collapses the two matrix entries into a single "Google Analytics 4"
  entry pointing to kits/google-analytics-4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ga4): add missing root config files omitted from migration

Restores the root-level config files that existed in the original
mparticle-integrations/mparticle-javascript-integration-google-analytics-4
repo but were not included in the monorepo migration:

- .eslintrc  — eslint + prettier config (root: true)
- .gitignore — ignores node_modules
- .prettierrc — singleQuote, trailingComma: es5, tabWidth: 4
- README.md  — usage docs for both client and server kits

Also updates package.json description to match the original.
The .github/workflows/ are omitted as the monorepo has its own CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(matrix): update kit matrix with all migrated kits and braze-6

Merges workstation/3.0-Release and adds all 28 kits to matrix.json:
- Braze 3/4/5 (merged), Braze 6 (open PR)
- Adobe Target, Adwords, Amplitude 8, Bing Ads
- Criteo, Device Match, DoubleClick, Dynamic Yield
- Facebook, Google Tag Manager, Heap, ID5 1
- Inspectlet, Intercom, KissMetrics, Leanplum 1
- Localytics 4, Mixpanel 2, OneTrust, Optimizely
- Rokt, SimpleReach, Taplytics, Twitter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: correct iife filename typo in KissMetrics rollup config

Fixes output filename from KissMetricsForwarder.iffe.js to
KissMetricsForwarder.iife.js.

Made-with: Cursor

* remove dist from root gitignore

* Revert "remove dist from root gitignore"

This reverts commit 2b12aca.

* chore(matrix): remove braze-6 until PR #1194 merges

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
khushi1033 and others added 5 commits July 29, 2026 14:24
* feat: migrate mparticle-javascript-integration-braze-6 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): update braze-6 package-lock.json to resolve @braze/web-sdk@6.5.0

Lock file was out of sync — still pinned to 5.5.0 while package.json
requires ^6.0.0. Regenerated with npm install --package-lock-only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

* chore(matrix): add braze-6 to kit matrix

* fix(braze-6): update bundle name and suffix from v5 to v6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…events

Ports upstream mparticle-javascript-integration-rokt v1.29.0–v1.30.1:
- feat: prevent caching of active_time_on_site_ms attribute (#106)
- feat: capture page views and surface as page_events in selectPlacements (#109)
- refactor: rename timeOnPage to activeTimeOnPage in selectPlacements page_events (#110)

Monorepo adaptations preserved (package.json peer/dev deps, vite aliases,
tsconfig paths). Adds --no-experimental-webstorage to vitest execArgv so
jsdom's localStorage is used on Node >= 25, where Node's experimental
webstorage global shadows it and broke the new page-view tests.
@rmi22186
rmi22186 requested a review from a team as a code owner August 5, 2026 20:26
@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes what behavioral data is sent to Rokt on selectPlacements and uses browser localStorage for page history; privacy/opt-out paths (noTargeting, session clear) are implemented but partners should verify expectations.

Overview
Brings kits/rokt from 1.28.3 to 1.30.1 (upstream Rokt integration).

Page views → Rokt placements: On PageView events (when targeting is enabled), the kit persists a bounded history in localStorage (mpPageViews, max 25, query strings stripped via sanitizeUrl). selectPlacements adds a JSON page_events attribute built from that store, including derived activeTimeOnPage from consecutive activeTimeOnSite values. History is cleared on session end, on init when noTargeting is set, and capture is skipped entirely when targeting is disabled. Page-view handling runs in process() even if the launcher is not ready yet.

Attribute caching: active_time_on_site_ms is added to the selectPlacements persistence deny list so it is sent on the current call but not cached for later placements.

Tests / tooling: Large Vitest coverage for page-view behavior and deny-list behavior; vite.config.ts passes --no-experimental-webstorage to Vitest workers so window.localStorage works under Node 25+ with jsdom.

Reviewed by Cursor Bugbot for commit d11687e. Bugbot is set up for automated code reviews on this repo. Configure here.

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants