ensure script laod flow is correct
This commit is contained in:
parent
eefaed1aab
commit
cf9d9e4596
3 changed files with 15 additions and 11 deletions
|
|
@ -1,9 +1,14 @@
|
|||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { loadBootstrap } from './adScripts/bootstrap';
|
||||
import { loadScript } from './adScripts/loadScript';
|
||||
|
||||
onMount(() => {
|
||||
window.graphicsAdQueue = window.graphicsAdQueue || [];
|
||||
loadScript(
|
||||
'https://graphics.thomsonreuters.com/cdn/js/bootstrap.static.js',
|
||||
loadBootstrap
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -22,15 +27,4 @@
|
|||
crossorigin=""
|
||||
/>
|
||||
<link rel="stylesheet" href="https://a.pub.network/reuters-com/cls.css" />
|
||||
|
||||
<script
|
||||
src="https://graphics.thomsonreuters.com/cdn/js/bootstrap.static.js"
|
||||
on:load="{loadBootstrap}"
|
||||
></script>
|
||||
|
||||
<script
|
||||
src="https://a.pub.network/reuters-com/pubfig.min.js"
|
||||
data-cfasync="false"
|
||||
async
|
||||
></script>
|
||||
</svelte:head>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import getParameterByName from './getParameterByName';
|
||||
import Ias from './ias';
|
||||
import { loadScript } from './loadScript';
|
||||
|
||||
const ONETRUST_LOGS = 'ot_logs';
|
||||
const ONETRUST_GEOLOCATION_MOCK = 'ot_geolocation_mock';
|
||||
|
|
@ -46,6 +47,9 @@ export const loadBootstrap = () => {
|
|||
);
|
||||
|
||||
(<any>window).bootstrap.getResults((result) => {
|
||||
// Load Freestar script
|
||||
loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
|
||||
|
||||
// Set GAM
|
||||
(<any>window).googletag = (<any>window).googletag || { cmd: [] };
|
||||
(<any>window).googletag.cmd.push(() => {
|
||||
|
|
|
|||
6
src/components/AdSlot/adScripts/loadScript.ts
Normal file
6
src/components/AdSlot/adScripts/loadScript.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export const loadScript = (src: string, onload?: () => void) => {
|
||||
const script = document.createElement('script');
|
||||
script.addEventListener('load', onload);
|
||||
script.src = src;
|
||||
document.head.append(script);
|
||||
};
|
||||
Loading…
Reference in a new issue