Merge pull request #147 from reuters-graphics/ad-flow-fix
Change script load flow to make it identical to initial implementation
This commit is contained in:
commit
7846ddd209
3 changed files with 12 additions and 6 deletions
|
|
@ -8,8 +8,10 @@
|
|||
window.graphicsAdQueue = window.graphicsAdQueue || [];
|
||||
loadScript(
|
||||
'https://graphics.thomsonreuters.com/cdn/js/bootstrap.static.js',
|
||||
loadBootstrap
|
||||
{ onload: loadBootstrap, async: false }
|
||||
);
|
||||
// Load Freestar script
|
||||
loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import getParameterByName from './getParameterByName';
|
||||
import Ias from './ias';
|
||||
import { loadScript } from './loadScript';
|
||||
|
||||
const ONETRUST_LOGS = 'ot_logs';
|
||||
const ONETRUST_GEOLOCATION_MOCK = 'ot_geolocation_mock';
|
||||
|
|
@ -42,9 +41,6 @@ export const loadBootstrap = () => {
|
|||
);
|
||||
|
||||
(<any>window).bootstrap.getResults((result) => {
|
||||
// Load Freestar script
|
||||
loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
|
||||
|
||||
// Set GAM
|
||||
window.googletag = (<any>window).googletag || { cmd: [] };
|
||||
window.googletag.cmd.push(() => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
export const loadScript = (src: string, onload?: () => void) => {
|
||||
interface attributesInterface {
|
||||
onload?: () => void,
|
||||
async?: boolean
|
||||
}
|
||||
|
||||
export const loadScript = (src: string, attributes?: attributesInterface) => {
|
||||
const { onload, async = true } = attributes || {};
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.addEventListener('load', onload);
|
||||
script.async = async;
|
||||
script.src = src;
|
||||
document.head.append(script);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue