Adding Google Analytics is important for website. Here in this article we given code snippet and show to Put Google Analytics code into your wordpress theme
Put Google Analytics code into your wordpress theme
Copy paste following lines to your wordpress theme folder’s functions.php file.
function google_analytics() { var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-12453889-1"); pageTracker._trackPageview(); } catch(err) {}</script> } add_action('wp_footer', 'google_analytics');
Dont forget to replace your google analytics code in google_analytics code.
have fun!