JS API methods for New-gen Instant Site.
Ecwid New-gen Instant Site was released some time ago, and one of its features is the homepage. There’s no product browser on the homepage, thus our regular JS API methods do not work there, since they are “based” on the product browser.
To sum up, all the apps that use our regular Storefront JS API methods do not work on the homepage of New-gen Instant Site by default.
To make your app work on the Homepage.
It is possible to make your app work on the homepage, yet it requires the following actions to be done.
1. Contact us.
Contact us at [email protected] and ask us to make your app available for New-gen Instant Site (there’s a certain internal setting). We will enable the setting for your app from our side.
2. Adjust your app.
We’ve released a few JS API methods for New-gen Instant Site that will help you to adjust your app and make it work on the homepage. These methods are similar to our regular JS API methods. Yet, please, note that not all the methods are currently available.
See New-gen Instant Site JS API methods:
- window.Ecwid.onAPILoaded / window.Ecwid.OnPageLoad
Also, only new Instant Sites have
window.instantsite object in the code. And you can now look for the
window.instantsite object on any store page.
We’ve added some new methods, which work on any store page. Here is the list of these methods:
window.instantsite.getSiteId()- gets store ID
window.instantsite.getAppPublicConfig('app_id')- gets a “public” key of the App Storage for the specific application by its client_id
window.instantsite.getAppPublicToken('app_id')- gets public_token of the specific application by its client_id
window.instantsite.onTileLoaded- subscribes to the event, so it is called when a tile (Instant Site’s content block) is loaded. Used when the needed block is redrawn, so the custom feature can react and update it the right way on the fly.
window.instantsite.onTileUnloaded- subscribes to the event, so it is called when a tile (Instant Site’s content block) is unloaded.
If you need more methods
Feel free to contact us at [email protected] if you need some other methods in order to make your app work correctly on the homepage.