Setup script to injection javascript in the head tag.
Variable | Description | Example |
---|---|---|
'src' | Path to the file | 'google.com/api/gtm.js' |
'id' | Script identifier | 'gtm-container' |
'VenderTrack' | Vendor's name | 'GoogleTagManager' |
(function(a,b,c,d,e,f,g,h){
if(typeof a['VendorTrack'] !== 'undefined') { return; }
a['VendorTrack'] = e;
g = b.getElementsByTagName(c)[0];
f = b.createElement(c);
f.type = 'text/javascript';
f.async = true;
f.src = '//' + d ;
f.id = e;
g.parentNode.insertBefore(f, g);
})(window,document,'script','src','id');