SmileUI.initialize() which is intended to replace the SmileUI.init() method (which is now deprecated). This article explains everything you need to know about the differences between them, who is impacted by this change, and how to migrate from the old to the new method.
Feature availability:
SmileUI.initialize() is available on Plus and Enterprise plans.Differences between init() and initialize()
Fundamentally, the only difference between theSmileUI.init() and SmileUI.initialize() methods is their arguments. Both accept an options hash (as described in our developer documentation), however the keys of the options hash have changed. Besides the new keys and their values, the behaviour of the two methods is identical.
| Old Options Key | New Options Key | New Value |
|---|---|---|
channel_key | publishableKey | The account’s publishable key. |
customer_identity_jwt | customerToken | A JWT signed using one of the account’s signing keys. Full instructions on JWT generation can be found here. |
How to determine where migration is needed
For your standard Shopify or BigCommerce storefront, no migration is needed. However, surfaces that will require migration are:- Anywhere (besides your Shopify or BigCommerce storefront) where you’ve manually added Smile’s rewards popup (launcher & panel) — such as on a custom storefront or another website.
- Anywhere you’ve manually included Smile’s JavaScript SDK — such as a custom checkout, landing page, or any other webpage.
- Anywhere you’re using Smile’s legacy integration with an e-commerce platform other than Shopify or BigCommerce (e.g. are using Storefront.js).
Migrating from init() to initialize()
Important: If you’re currently using Storefront.js, refer to our guide for migrating from Storefront.js to Smile.js instead.
- Your account is on a plan that includes JavaScript SDK access. The easiest way to confirm this is in Smile Admin, going to Settings > Developer Tools. If you see a card to Manage signing keys and there is a button to generate a new signing key, then you have access!
- You have a full and complete list of any frontends where you’ve manually included Smile UI / Smile.js / Smile’s JavaScript SDK (see above).
- In Smile Admin, create a new signing key specifically for the web property.
- Choose a name that represents the web property the key will be used on (e.g. “Marketing Website”).
- Replace any calls to the old
SmileUI.init()method to instead callSmileUI.initialize(), ensuring that you’re using the new keys in the options hash (refer to our developer documentation). - Repeat these steps for every web property where you’ve manually included the JavaScript SDK.
SmileUI.init() method, so you’ll need to ensure that you’ve migrated before that date or your code will stop working.