- CodeIgniter 2
- CodeIgniter Sparks
- Install Sparks if you haven't done so already.
- Install the google-analytics-lib spark (see here if you don't know how).
google-analytics-lib is a spark that allows to include google analitics on your project in production mode.
controler call
To load the google-analytics-lib spark..
config-> autoload.php
config-> config.php
libraries->analytics.php
In config file setup source where your js for analitics is stored
$config['source'] = '/theme/js/ganalitics.js';
Into your views file in header you need to seample call global variable ganalitics.
if( defined('ganalytics') ) { print( ganalytics ); }
When ENVIRONMENT setup to production your google analytics will be include into the page.