Created
October 15, 2019 03:24
-
-
Save wptraining/02a4a9b53c95994e1879f791fae6c9b8 to your computer and use it in GitHub Desktop.
WPMU DEV - Google Analytics plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpmudev_google_analytics() { ?> | |
<!-- Global site tag (gtag.js) - Google Analytics --> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-XX"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'UA-XXXXXXXX-XX'); | |
</script> | |
<?php } | |
add_action( 'wp_head', 'wpmudev_google_analytics', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment