A Javascript App is a kind of Jumpseller App that can insert javascript on the front-end of a store. This functionality is useful to integrate external applications, like chats, newsletter forms and visitor tracking tools on a store without manipulating any HTML code.

With javascript you can easily add new components to the store and you can add or change the HTML/CSS without touching the store theme.


Contents

  1. Add a Javascript Tag to a Store
  2. Other useful API endpoints

Add a Javascript Tag to a Store

You need to have a general Jumpseller App created to be able to add a javascript tag to a store. Make sure you read the article on how to create a general Jumpseller App.

To install the javascript tag on a Jumpseller store, a POST request must be performed:

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -X POST "https://api.jumpseller.com/v1/jsapps"

with the following JSON content:

{ app :
  {
    url: "https://example/test.js",
    template: "see the options below",
    element: "see the options below"
  }
}

Let's understand each key-value option:

Key Description/Value
url Required. The javascript URL that will be loaded on the store.
template Required. The theme template where the javascript will be injected. (layout, home, product, etc)
element Required. The HTML target element to inject the javascript: (head or body)

A Jumpseller App can include several javascript tags on the same store. If you add a javascript for a Jumpseller App on the same template and element where one already exists, the previous one is replaced.

If you need to include several javascripts on the same location or need to include CSS or any assets with the script, you can easily use a package manager like Webpack and bundle everything together for fast loading times.


Other useful API endpoints

To list all the javascript installed on the store by a Jumpseller App use the GET request below:

GET "https://api.jumpseller.com/v1/jsapps/:code"

where code is the code field available at the App edition page after the App was created in the Jumpseller Admin.

This is the cURL version of this request:

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -X GET "https://api.jumpseller.com/v1/jsapps/:code"

To destroy a javascript tag installed on the store by a Jumpseller App, perform this DELETE request:

DELETE "https://api.jumpseller.com/v1/jsapps/:id"

where id is the id returned from the request used to list all installed javascripts above.

This is the cURL version of this request:

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -X DELETE "https://api.jumpseller.com/v1/jsapps/:id"