Last modified March 9, 2022 by Shelly Wolfe

Web SDK upgrade guide

This guide provides information about how you can upgrade to the latest Swrve Web SDK. For information about the changes that have been made in each Web SDK release, see the Web SDK release notes.

Upgrading via NPM

If you’re upgrading via NPM, update your package .json dependency @swrve/web-sdk to the latest version of npm i @swrve/web-sdk.


Version 2.0.0

There are several code changes and improvements added to Swrve Web SDK v2.0.0.

The following table lists the methods and fields that have changed or been moved.

Removed Summary
getQueuedEvents Removed to align with other Swrve SDKs.
Moved or changed Summary
createInstance This was formerly the way to start up the SDK but it now only creates an instance. It also no longer initializes the SDK. Use initWithConfig instead.
OnSwrveLoadedCallback This callback was added to initWithConfig as an optional argument. It also no longer has an error message in its response. If something goes through, an exception is now thrown, which can be caught.
It goes in after config. For example: initWithConfig({appId: <your_id>, apiKey: <your_key>, externalUserId: <your_ex_user_id>}, ()=>{ console.log("optional callback")});
namedEvent Renamed to event
purchaseEvent Renamed to purchase
iapEvent Renamed to iap

 

Changes to initialization

The public method createInstance is still available for use but does not initialize the SDK. This means the SDK no longer starts from createInstance. If you want to have the same functionality as createInstance, please use initWithConfig.


Version 1.4.3

There are no code changes required to upgrade to Swrve Web SDK v1.4.3.


Version 1.4.2

There are no code changes required to upgrade to Swrve Web SDK v1.4.2.


Version 1.4.1

There are no code changes required to upgrade to Swrve Web SDK v1.4.1.


Version 1.4.0

There are no code changes required to upgrade to Swrve Web SDK v1.4.0.


Version 1.3.2

There are no code changes required to upgrade to Swrve Web SDK v1.3.2.


Version 1.3.1

There are no code changes required to upgrade to Swrve Web SDK v1.3.1.


Version 1.3.0

This section provides information to enable you to upgrade to Swrve Web SDK v1.3.

In-app purchase events

If you want to use in-app purchase events in your integration, see the In-app purchase events section of the Web integration guide.


Version 1.2.1

There are no code changes required to upgrade to Swrve Web SDK v1.2.1.


Version 1.2.0

This section provides information to enable you to upgrade to Swrve Web SDK v1.2.

“Default” no longer required

If you are using an ES5 / ES6 implementation, you no longer need to use .default in your method call. For example, instead of SwrveSDK.default.sendEvent, use SwrveSDK.sendEvent.


Version 1.1.0

This section provides information to enable you to upgrade to Swrve Web SDK v1.1.

Web push notifications

If you are want to send your website users push notifications, see the Push Notifications section of the Web SDK integration guide.