- 13 Dec 2023
- 1 Minute to read
- Print
- DarkLight
Ensighten
- Updated on 13 Dec 2023
- 1 Minute to read
- Print
- 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
1. 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 into 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');
});
2. How to inject the Jornaya Script using .loadScriptCallback()
Bootstrapper.loadScriptCallback('//create.lidstatic.com/campaign/YOUR_LOWERCASE_JORNAYA_CAMPAIGN_KEY_HERE.js?snippet_version=2';, function() {
console.log('LeadiD Script Campaign has been injected');
});
3. 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 in the Create Implementation Testing to confirm the integration is working as expected.