Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add Google Analytics
* GA
function _thz_action_add_ga(){
$GAcode = 'XX-XXXXXX-X'; // change with your GA tracking code
echo '<script async src=""></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(\'js\', new Date()); gtag(\'config\', \''.$GAcode.'\'); </script>';
add_action('wp_footer', '_thz_action_add_ga');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment