Posted By

alp on 06/06/11


Tagged

wordpress functionsphp


Versions (?)

Wordpress: Add Google Analytics to Footer


 / Published in: PHP
 

URL: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/

  1. /**
  2.  * Add Google Analytics to Footer
  3.  * http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/
  4.  *
  5.  **/
  6. function myfunction_add_google_analytics() {
  7. echo '<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>';
  8. echo '<script type="text/javascript">';
  9. echo 'var pageTracker = _gat._getTracker("UA-XXXXX-X");';
  10. echo 'pageTracker._trackPageview();';
  11. echo '</script>';
  12. }
  13. add_action('wp_footer', 'myfunction_add_google_analytics');

Report this snippet  

You need to login to post a comment.