Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@danyj
Last active July 23, 2018 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danyj/009783f1513f342d318d73c993e2a36a to your computer and use it in GitHub Desktop.
Save danyj/009783f1513f342d318d73c993e2a36a to your computer and use it in GitHub Desktop.
Add Google Analytics
/**
* GA
*/
function _thz_action_add_ga(){
$GAcode = 'XX-XXXXXX-X'; // change with your GA tracking code
echo '<script async src="https://www.googletagmanager.com/gtag/js?id=UA-63305981-2"></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