- 05 Jan 2023
- 1 Minute to read
- DarkLight
Ensighten
- Updated on 05 Jan 2023
- 1 Minute to read
- DarkLight
Summary
The Ensighten library (Bootstrap.js file) includes several helpful functions and frameworks that assist in implementing tags across a site. To load the Jornaya javascript via Ensighten we can utilize .loadScriptCallback(). If you have any questions or require additional assistance, please contact support@jornaya.com
Instructions
Using the .loadScriptCallback() function
The loadScriptCallback function inserts a script tag into the current web page asynchronously and executes custom JavaScript code (callback) once the script file has completed downloading.
Parameters
- @param1 {string} - URL of the JavaScript file to insert in the page
- @param2 {function} - JavaScript code to execute after the script tag downloads and executes
- @param3 {boolean} - Optional, default false. Determines whether or not to insert a script with the same src already on the page (false = does not re-insert the script if the script is already on the page)
Example
Insert a script file and then print the console log message once the file is downloaded.
Bootstrapper.loadScriptCallback('//www.example.com/exampleScript.js';, function() {
console.log('File has been downloaded');
});
How to inject the Jornaya Script using .loadScriptCallback() Be sure to replace the "//create..." url in the example below with your Jornaya Campaign script (obtained from within your account in the Jornaya Member Portal). To get your Jornaya Campaign Code, please see our Getting Started Guide.
Bootstrapper.loadScriptCallback('//create.lidstatic.com/campaign/83838383-8383-8383-8383-838383838383.js?snippet_version=2';, function() {
console.log('LeadiD Script Campaign has been injected');
});
Confirm the script is working properly
- Save all changes and open the website in a new tab to confirm everything is working properly.
- Follow the steps list in this article to confirm the integration is working as expected: Create Implementation Testing.