Hello,
I already tried the solutions posted on this forum between 2017 and 2018, but they do not work.
In my assets folder, I have the following gtag.js:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-.........-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-.........-.');
</script>
And at the bottom of my app.py, I have
external_js = ["https://code.jquery.com/jquery-3.2.1.min.js",
"https://codepen.io/bcd/pen/YaXojL.js",
"http://www.mywebsite.com/assets/gtag.js"]
for js in external_js:
app.scripts.append_script({"external_url": js})
But it doesnt work.
Even if I just write
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘UA-…-.’);
in gtag.js, it doesnt work. What’s wrong ??
Is it normal that these scripts are in the footer instead of in the head of the app ?