Migrating from v2

Batch Web SDK v3 is a major release, which introduces breaking changes from 2.x. This guide describes how to update the script in a website already using a previous version.

Upgrading the SDK version

To upgrade from v2 to v3, you need to change the SDK version in two places:

  • On your page script or tag manager, replace https://via.batch.com/v2/bootstrap.min.js with https://via.batch.com/v3/bootstrap.min.js.
  • Download the new SDK files from the download page and update your service worker implementation
    • If you're using batchsdk-worker-loader.js, simply replace this file with the new one.
    • If you added Batch in your custom service worker implementation, set BATCHSDK_MAJOR_VERSION's value to 3.

Safari support

Support for Safari push notifications has been introduced and requires additional configuration. See our Safari documentation for more info.

Removal of insecure HTTP/Multidomain mode

This SDK version has removed support for the HTTP/Multidomain mode: HTTPS is now required to use the SDK and origins are isolated as expected by web standards.

As migrating from the multidomain mode has implications developers need to be aware of, the SDK will refuse to start if sameOrigin: true is set in the configuration. Remove it once you want to start your migration.

Note: Migrating a website from the HTTP/Multidomain mode should be done with care. Please reach out to our team before upgrading so we can discuss your specific goals and advise you on this topic.