Plugin for Laravel 4 just to include Google Analytics script in your views
- Add
carloscsrm/googleanalytics
tocomposer.json
.
"carloscsrm/googleanalytics": "1.1.*"
-
Run composer update to pull down the latest version of Google Analytics package.
-
Now open up app/config/app.php and add the service provider to your providers array.
'providers' => array( 'Carloscsrm\Googleanalytics\GoogleanalyticsServiceProvider', ),
The Alias is automatically added by the system, you don't need add it manually. The alias is Googleanalytics
Run php artisan config:publish carloscsrm/googleanalytics
and modify the config file with your own Analytics ID.
For using this package you can add this code in your templates
{{Googleanalytics::render()}}