I've added the following Google Tag and Google Analytics code in my website. When i checked with Google Tag Assistant (Chrome Addon), I can find a yellow indicator against Google Analytics Tag which says to optimize "Same web property ID is tracked twice." As well as i can see "2 Pageview Requests"
How could i resolve this? Is that because I've added both Google Tag Manager and Google Analytics? I need both Google Tag Manager and Google Analytics run together smoothly without these kind of issues.
Google Tag Manager and Google Analytics Script added below
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-27898392-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-27898392-1');
</script>
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-27898392-1', 'auto');
ga('set', 'userId', '123456');
//Custom-User-ID - index 1
ga('set', 'dimension1', '123456');
//Custom-User-Name - index 2
ga('set', 'dimension2', 'jerome');
//Custom-User-Email - index 3
ga('set', 'dimension3', 'haijerome@gmail.com');
//Custom-User-Customer-ID - index 4
ga('set', 'dimension4', '123456');
//Custom-User-Customer-Name - index 5
ga('set', 'dimension5', 'Test');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->