jsclient1.11.0

zjunlp/OmniThinkjsclient1.11.0Jun 23, 2026by github-actions[bot]

AI Summary

This release introduces GTM self-managed loading, synchronous anonymous ID generation, and auto-identify on initialization, alongside fixes for array merging and SSR issues.

Key Highlights

  • GTM destination self-managed loading with new `loadGtm` and `resetDataLayer` options
  • Synchronous anonymous ID creation via `preInitAnonymousId` option
  • Auto-identify on init when `userId` is provided
  • New `user()` method for privacy-aware user retrieval
  • Fixes for SSR support and array value merging behavior

Breaking Changes

  • Passing `userId` in options now triggers an automatic `identify` on init
  • Array values in event payloads now fully replace rather than element-wise merge

New Features

  • GTM self-managed loading (`loadGtm` and `resetDataLayer`)
  • `preInitAnonymousId` option
  • Auto-identify on init
  • New `user()` method

Full Release Notes

# Jitsu Client Libraries 1.11.0

Changes that affect users of `@jitsu/js` (and `@jitsu/react`) since `1.10.4`. Build/tooling, packaging and internal refactors are omitted.

### New features
- **GTM destination — self-managed loading.** New `loadGtm` option lets you load Google Tag Manager yourself; Jitsu then only pushes to the data layer instead of injecting the GTM script. New `resetDataLayer` option (default `true`) controls whether Jitsu clears the data it pushed between events, clearing only Jitsu-set keys rather than resetting the whole data layer.
- **`preInitAnonymousId` option.** Creates the anonymous-id cookie synchronously at init, so the id is available for first-page server-side reads instead of being set lazily on the first event.
- **Auto-identify on init.** If `userId` is passed in the options, the client now writes it to storage and automatically sends an `identify` on startup, so the user is identified before your first explicit call.
- **New `user()` method.** Returns the current user — privacy-aware (returns no id when user ids are disabled) and falls back to the configured `userId` until `reset()` is called.

### Fixes
- Array values in traits / properties / context are now replaced wholesale on merge instead of being merged element-by-element (prevents stale array items leaking between merges).
- Server-side / no-URL events no longer throw when there is no page URL (Node / SSR usage).
- Script-tag `data-*` attribute parsing is now null-safe — a missing attribute no longer crashes initialization.
- Auto-identify failures are logged as warnings instead of being routed to your configured error handler, so they can't trip your error policy.
- Correct anonymous-id cookie scoping on `vercel.app` and `webflow.io` (added to the public-suffix list).
- ga4: skip the `page_view` event when page properties are missing (avoids emitting malformed events).
- logrocket: guard against a missing method when flushing queued calls.

### Behavior changes — please review when upgrading from 1.10.4
- Passing `userId` in the constructor options now triggers an automatic `identify` on init and populates `user().id` before any explicit `identify()` call. If you relied on no event being sent until your first call, this is a new network side-effect.
- Array values in event payloads now fully replace rather than element-wise merge — payloads that combine arrays may serialize differently than in 1.10.4.

**Full diff:** https://github.com/jitsucom/jitsu/compare/jitsu-js-libs-v1.10.4...jsclient1.11.0