Last active
July 23, 2018 08:45
-
-
Save danyj/009783f1513f342d318d73c993e2a36a to your computer and use it in GitHub Desktop.
Add Google Analytics
This file contains hidden or 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
/** | |
* 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