PageRenderTime 60ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/baser/views/elements/google_analytics.php

https://github.com/hashing/basercms
PHP | 35 lines | 14 code | 3 blank | 18 comment | 3 complexity | 4fd59a5c6afb997019833cd10f928085 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * [PUBLISH] Google Analytics
  5. *
  6. * PHP versions 5
  7. *
  8. * baserCMS : Based Website Development Project <http://basercms.net>
  9. * Copyright 2008 - 2012, baserCMS Users Community <http://sites.google.com/site/baserusers/>
  10. *
  11. * @copyright Copyright 2008 - 2012, baserCMS Users Community
  12. * @link http://basercms.net baserCMS Project
  13. * @package baser.views
  14. * @since baserCMS v 0.1.0
  15. * @version $Revision$
  16. * @modifiedby $LastChangedBy$
  17. * @lastmodified $Date$
  18. * @license http://basercms.net/license/index.html
  19. */
  20. ?>
  21. <?php if (!empty($siteConfig['google_analytics_id'])): ?>
  22. <script type="text/javascript">
  23. var _gaq = _gaq || [];
  24. _gaq.push(['_setAccount', '<?php echo $siteConfig['google_analytics_id'] ?>']);
  25. _gaq.push(['_trackPageview']);
  26. (function() {
  27. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  28. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  29. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  30. })();
  31. </script>
  32. <?php endif ?>