How to use a JS variable in another Custom JS script?
In GTM, it's usually by replacing the var name with {{var name}}. How do I do in this Adobe launch?
I have a custom JS that's simply not reading directly from the console log. However, if I separately declare a Data Element that's a JS variable that reads from performance.timing.requestStart, I can see the value in Cloud Debugger.
How can I apply such variables here for startTime and endTime var in below code?
thanks.
function getPageLoadTime() {
if (typeof(performance) !== 'undefined' && typeof(performance.timing) == 'object') {
var timing = performance.timing;
// fall back to less accurate milestones
var startTime = performance.timing.requestStart;
var endTime = performance.timing.loadEventEnd;
if (startTime && endTime && (startTime < endTime)) {
return (endTime - startTime);
}
}
return 'data not available';
}