/baser/views/elements/google_analytics.php
PHP | 35 lines | 14 code | 3 blank | 18 comment | 3 complexity | 4fd59a5c6afb997019833cd10f928085 MD5 | raw file
Possible License(s): MIT
- <?php
- /* SVN FILE: $Id$ */
- /**
- * [PUBLISH] Google Analytics
- *
- * PHP versions 5
- *
- * baserCMS : Based Website Development Project <http://basercms.net>
- * Copyright 2008 - 2012, baserCMS Users Community <http://sites.google.com/site/baserusers/>
- *
- * @copyright Copyright 2008 - 2012, baserCMS Users Community
- * @link http://basercms.net baserCMS Project
- * @package baser.views
- * @since baserCMS v 0.1.0
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
- * @license http://basercms.net/license/index.html
- */
- ?>
- <?php if (!empty($siteConfig['google_analytics_id'])): ?>
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', '<?php echo $siteConfig['google_analytics_id'] ?>']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
- <?php endif ?>