Merge pull request #203 from jmowatt/feature/google-analytics-per-organiser-support

Per Organiser Google Analytics
This commit is contained in:
Dave Earley 2016-09-17 17:50:17 +01:00 committed by GitHub
commit f728bc6ac0
6 changed files with 57 additions and 2 deletions

View File

@ -45,6 +45,7 @@ class OrganiserCustomizeController extends MyBaseController
$organiser->name = $request->get('name');
$organiser->about = $request->get('about');
$organiser->google_analytics_code = $request->get('google_analytics_code');
$organiser->email = $request->get('email');
$organiser->enable_organiser_page = $request->get('enable_organiser_page');
$organiser->facebook = $request->get('facebook');

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddGoogleAnalyticsCodeToOrganiser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('organisers', function (Blueprint $table) {
$table->string('google_analytics_code')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('organisers', function (Blueprint $table) {
$table->dropColumn('google_analytics_code');
});
}
}

View File

@ -93,7 +93,13 @@
'rows' => 4
)) !!}
</div>
<div class="form-group">
{!! Form::label('google_analytics_code', 'Organiser Analytics Code', array('class'=>'control-label')) !!}
{!! Form::text('google_analytics_code', Input::old('google_analytics_code'),
array(
'class'=>'form-control'
)) !!}
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">

View File

@ -0,0 +1,10 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ $analyticsCode }}', 'auto');
ga('send', 'pageview');
</script>

View File

@ -45,5 +45,6 @@
{!!HTML::script('assets/javascript/frontend.js')!!}
@include('Shared.Partials.GlobalFooterJS')
@yield('foot')
</body>
</html>

View File

@ -20,4 +20,10 @@
@include('Public.ViewOrganiser.Partials.OrganiserHeaderSection')
@include('Public.ViewOrganiser.Partials.OrganiserEventsSection')
@include('Public.ViewOrganiser.Partials.OrganiserFooterSection')
@stop
@stop
@if($organiser->google_analytics_code)
@section('foot')
@include('Public.Partials.ga', ['analyticsCode' => $organiser->google_analytics_code])
@stop
@endif