Created
January 27, 2020 18:27
-
-
Save BurlesonBrad/a367773496e4f645529a5e979eac1bca to your computer and use it in GitHub Desktop.
๐ซNo WordPress plugin needed to add tracking code to the header ๐
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
function header_tag_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> | |
// Add your Tweeder scripts Adroll scripts Facebook scripts BounceX scripts Optimizely scripts or whatever needs to be in the head | |
<?php } | |
add_action( 'wp_head', 'header_tag_analytics', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment