The javascript part of my html files looks like that :
<script async src="myscript.js"></script>
<script async src="//www.googletagmanager.com/gtag/js?id=UA-XXXXXX-X"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','UA-XXXXXX-X');</script>
I'm not really a javascript specialist. So, I don't really understand what the last script is doing. And I wonder if I could copy and paste this code into my myscript.js to save a few bytes?
What bother me is the "async" property of my script. Is it compulsory to execute this part of the google analytics script in the beginning of the page?
I've read a lot of questions and answers about this subject but none allow me to understand clearly. And most of them are about the previous analytics script and not this one.