I am getting frustrated. I want to use custom html code in GTM, for numerous reasons. I am trying to integrate a basic Google Ads code via GTM, but it doenst accept the following :
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-XXXXX');
GTM tells me that this is not valid :
"Error on line 10 and caracter 9 : This language feature is only supported for ECMASCRIPT_2015 mode or better: block-scoped function declaration."
Which is really irritating me, because it's their own code... any suggestions?
On a Google help page, it says you shouldn't use custom html code for gtag integration.
Please try this instead, turning the gtag
function declaration into an expression:
window.dataLayer = window.dataLayer || [];
var gtag = function () { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'AW-XXXXX');