jsclient1.11.0

jitsucom/jitsujsclient1.11.0Jun 23, 2026by github-actions[bot]

AI Summary

This release focuses on client-side SDK improvements, introducing self-managed Google Tag Manager loading, automatic user identification on initialization, and a new `user()` method. It also includes critical fixes for array merging behavior and cookie scoping.

Key Highlights

  • GTM destination now supports self-managed loading via `loadGtm` option
  • Automatic `identify` event is now sent on init if `userId` is provided
  • New `user()` method for privacy-aware retrieval of current user state
  • Array values in payloads now replace wholesale instead of element-wise merge
  • Fixes for anonymous-id cookie scoping on specific domains

Breaking Changes

  • Passing `userId` in constructor options now triggers an automatic `identify` event immediately
  • Array values in traits/properties are now replaced wholesale instead of merged element-by-element

New Features

  • `loadGtm` option for self-managed Google Tag Manager
  • `resetDataLayer` option to control data layer clearing
  • `preInitAnonymousId` option for synchronous anonymous ID creation
  • Auto-identify on init functionality
  • 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