Inserting a Custom JavaScript File

Admin: eCommerce Admin
Page: Advanced Customization > Javascript Insertion
URL: {client_ID}.retailadmin.directscale.com/#/Insertion

Adding a custom JavaScript file to the Web Office or eCommerce Shop is easy. Just create a JavaScript Insertion using the JavaScript Insertion page of the appropriate Admin site. You only need the JavaScript file's URL.



Adding an Insertion

  1. In the JavaScript Insertions page, click + ADD INSERTION.
  2. Select Custom Script from the Insertion Type menu.
  3. Enter a sort Name.
  4. In the JavaScript Code Editor, paste the following code:
// Create new script Element
var fileref = document.createElement("script");

// set the attributes for script element
fileref.setAttribute("type", "text/javascript");

// REPLACE url of file
fileref.setAttribute("src", "https://www.example.com/js/script.js");

// Append script element to HTML head
document.getElementsByTagName("head")[0].appendChild(fileref);

If you need a place to upload your JS file, you can use the Miscellaneous page in either the Web Office Admin or eCommerce Admin, and copy the provided URL.

Read more: Uploading Files and Assets


Did this page help you?