This is a major release, please see our Migration Guide for more info on what changed since 3.x.
Core:
- Added builtin German translations.
- Added optional
defaultDataCollection
configuration object to the Batch'ssetup
method. This allows you to enable the geoip back-end resolution for the user'sregion
attribute which is now disabled by default. - Added optional
migrations
configuration object to the Batch'ssetup
method. This allows you to disable data migrations to the new Batch user-centric data model (enabled by default).
Core - Service worker:
- Moved Service Worker related configuration keys in a
serviceWorker
object. automaticallyRegister
replaceduseExistingServiceWorker
. Set it tofalse
to prevent Batch from automatically registering
its worker. Default:true
.waitTimeout
replacesserviceWorkerTimeout
but works the same.registration
allows you to have Batch use a specific Service Worker registration.
This can be a Service Worker registration for a sub-scope that does not control the current page.
Be careful: Batch can't check that this SW will properly work, your integration might break if your SW is not valid for push
notifications.
Usingregistration
requiresautomaticallyRegister
to be false. Not setting it defaults tonavigator.serviceWorker.ready
.serviceWorkerPathOverride
has been removed: manually register a service worker with your custom path and give the
Promise to the SDK inregistration
.
Core - User/Profile:
In the past, data was siloed between different platforms. However, Projects remove this limitation by introducing profiles. Each Project is associated with a unified userbase made up of profiles. When users interact with any of the platforms (website, iOS app, Android app...) within a Project, their actions are fed into the associated Profiles.
Web SDK v4 APIs are fully compatible with profiles and allow you to set attributes and events on omnichannel profiles:
- Removed
setCustomUserID
API (has been replaced withidentify
). - Removed
getCustomUserID
API. (no equivalent) - Removed
setUserLanguage
API (has been replaced withsetLanguage
). - Removed
setUserRegion
API (has been replaced withsetRegion
). - Removed
editUserData
API (has been replaced withedit
). - Removed
IUserDataEditor
interface. (has been replaced withIProfileDataEditor
). - Removed
addTag
API (has been replaced withaddToArray
). - Removed
removeTag
API (has been replaced withremoveFromArray
). - Updated
trackEvent
parameters (EventDataParams
):- Added support for
Array
andObject
attribute types. - Replaced optional
tag
attribute with$tags
as reserved key under theattributes
object. - Replaced optional
label
attribute with$label
as reserved key under theattributes
object.
- Added support for
- Added
profile
API to get the public profile module. Please see API references for more info. - Added
identify
API underIBatchProfile
as replacement ofsetCustomUserID
. - Added
edit
API underIBatchProfile
as replacement ofeditUserData
. - Added
setEmailAddress
API (this requires to have a custom user ID registered). - Added
setEmailMarketingSubscription
API. - Added
setLanguage
API underIProfileDataEditor
as replacement ofsetUserLanguage
. - Added
setRegion
API underIProfileDataEditor
as replacement ofsetUserRegion
. - Added
clearInstallationData
API. Clear all related data to the user's installation and wipe user's local data. This doesn't affect profile's data.