I think I understand what you want. Check out this example. In it I have added a link to an external script that I use to hold a variable. You can edit the external script and change the value of the variable without having to re-export the lesson.
One thing to note. I used ‘bottom of file scripting’ to link to the external script. The Trivantis application developers have this incorrect as it places what you link in this way AFTER the closing HTML tag. The only reason why it works is because modern browsers do a very good job at working with broken, bad HMTL. Bottom of file scripting SHOULD put the script just BEFORE the closing BODY tag.
Also keep in mind that if you go this route, you’ll have to manually place the external JS file in the right location in the exported files. My attachment includes the file main.js. This is the external JS file that I put there after the export.
Regarding what I posted earlier. Normally, you need to in some way use a Lectora variable (to initialize it) before you can use it with JS. You’re onPageShow action would do the trick.