FUEL CMS User Guide : Version 0.9.3


Google Helper

Contains a function for inserting Google Analytics code.

This helper is loaded using the following code:

$this->load->helper('google');

The following function is available:

google_analytics([uacct])

Returns Google Analytics code. If no uacct is provided, it will look for a config value of google_uacct.

echo google_analytics('abc123');

// echos out
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'abc123']);
  _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>