const params = (new URL(document.location)).searchParams;
const shouldLoadScript = params.get('script'); // 'true'
if (shouldLoadScript) {
const script = document.createElement('script');
script.src = 'https://url.com/script.js';
document.head.append(script)
}