SPM JS error: Sailthru is not defined

If your site is loading scripts synchronously, but the script is still returning a Sailthru is not defined error, we recommend checking if Require JS running on the site.

Often you can see if any of these are running on site by looking at the Network tab in dev tools or searching for "require" in the console: 


RequireJS is not required to be or not be on the site for the SPM JS to work, but when it is on the site, there are dependencies. SPM JS script is setup to assume that it will be loaded by RequireJS if the script is already loaded. If RequireJS is loaded first, the Sailthru is not defined error can come up.

The the options for when requireJS is on the site are

  1. Setup SPM JS to to load using requireJS or
  2. Load SPM JS before the RequireJS script tag

Code to setup SPM JS to load using RequireJS

The following code can be used to load the setup SPM JS to load using RequireJS

require(["Sailthru"], function (Sailthru) {
console.log("Optional log returned in Console to show SPM JS loaded onsite! Remove this line if not needed");

{ customerId: '<paste customer ID here>'}



Note: The code provided is sample code. All code should be thoroughly tested before running on the production site. 


Additional resources: