hexo-theme-ayer/layout/_partial/google-analytics.ejs
2022-05-23 16:36:09 +08:00

11 lines
388 B
JavaScript

<% if (theme.google_analytics){ %>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= theme.google_analytics %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<%= theme.google_analytics %>');
</script>
<% } %>