Skip to content

feat: prevent caching of active_time_on_site_ms attribute - #106

Merged
alexs-mparticle merged 1 commit into
developmentfrom
time-on-site-passthrough
Jul 31, 2026
Merged

feat: prevent caching of active_time_on_site_ms attribute#106
alexs-mparticle merged 1 commit into
developmentfrom
time-on-site-passthrough

Conversation

@alexs-mparticle

@alexs-mparticle alexs-mparticle commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds active_time_on_site_ms to the selectPlacements attribute persistence deny-list so the value forwards to the Rokt SDK on the current call but is never cached into this.userAttributes.

Time-on-site is a moving value. Because the kit caches forwarded attributes and re-sends them on subsequent selectPlacements calls until user attributes change, a cached copy would be re-sent stale on later calls. Deny-listing it means each call sends its own fresh value (or none), never a stale one — exactly how commerce attributes (confirmationRef, totalprice, etc.) are already handled.

The kit is an open pass-through, so no change was needed for the value to flow — this is purely about correctness (avoiding a stale cached value).

Related

Rollout order: this kit change should ship before mParticle/mparticle-web-sdk#1303. The kit is what strips the value from the persistence cache, so deny-listing it must be live before the core SDK starts emitting the attribute — otherwise the moving value could be cached and re-sent stale in the window between the two deploys.

Changes

  • src/selectPlacementsAttributePersistence.ts — add active_time_on_site_ms to SELECT_PLACEMENTS_ATTRIBUTE_PERSISTENCE_DENY_LIST (matched case-insensitively).
  • test/src/tests.spec.ts — 3 new tests:
    • Forwards active_time_on_site_ms on the current call without caching it.
    • A later call sends its own fresh value; no stale re-send, cache stays empty.
    • isSelectPlacementsAttributePersistenceDenied matches the key case-insensitively.

Verification

  • Lint: PASS
  • Build: PASS (bundles emit; only a pre-existing TS2339 dts warning unrelated to this change)
  • Tests: 210 passed (+3 new)

🤖 Generated with Claude Code

Add active_time_on_site_ms to the selectPlacements persistence deny-list
so it forwards to the Rokt SDK on the current call but is never cached
into userAttributes. Time-on-site is a moving value; caching it would
cause a stale copy to be re-sent on subsequent selectPlacements calls.

Mirrors how commerce attributes (confirmationRef, totalprice, etc.) are
handled: forwarded-but-not-persisted.
@alexs-mparticle
alexs-mparticle changed the base branch from main to development July 30, 2026 21:01
@alexs-mparticle
alexs-mparticle merged commit 315c4f9 into development Jul 31, 2026
4 of 5 checks passed
@alexs-mparticle
alexs-mparticle deleted the time-on-site-passthrough branch July 31, 2026 14:30
github-actions Bot pushed a commit that referenced this pull request Jul 31, 2026
# [1.29.0](v1.28.3...v1.29.0) (2026-07-31)

### Features

* prevent caching of active_time_on_site_ms attribute ([#106](#106)) ([315c4f9](315c4f9))
@mparticle-automation

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.29.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants