Skip to content

Firefly III: a personal finances manager

Reimplemented GA code. [skip ci]

James Cole765152d04b99
diff --git a/resources/twig/layout/default.twig b/resources/twig/layout/default.twig
index 750e8b33f2..8e104a4231 100644
--- a/resources/twig/layout/default.twig
+++ b/resources/twig/layout/default.twig
@@ -13,12 +13,12 @@
</title>
<base href="{{ route('index') }}/">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
- <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
- <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
- <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
- <link href="dist/css/skins/skin-blue-light.min.css" rel="stylesheet" type="text/css" />
- <link href="css/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
- <link href="css/firefly.css" rel="stylesheet" type="text/css" />
+ <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
+ <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
+ <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css"/>
+ <link href="dist/css/skins/skin-blue-light.min.css" rel="stylesheet" type="text/css"/>
+ <link href="css/daterangepicker-bs3.css" rel="stylesheet" type="text/css"/>
+ <link href="css/firefly.css" rel="stylesheet" type="text/css"/>
{% block styles %}{% endblock %}
<!--[if lt IE 9]>
@@ -77,7 +77,7 @@
<!-- search form -->
<form action="{{ route('search') }}" method="get" class="sidebar-form">
<div class="input-group">
- <input type="text" name="q" class="form-control" placeholder="Search..." value="{{ query }}" />
+ <input type="text" name="q" class="form-control" placeholder="Search..." value="{{ query }}"/>
<span class="input-group-btn">
<button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
</span>
@@ -105,8 +105,10 @@
<!-- actual content -->
{% block content %}{% endblock %}
- </section><!-- /.content -->
- </div><!-- /.content-wrapper -->
+ </section>
+ <!-- /.content -->
+ </div>
+ <!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
@@ -117,7 +119,8 @@
{% include('partials/control-bar.twig') %}
-</div><!-- ./wrapper -->
+</div>
+<!-- ./wrapper -->
<!-- Modal -->
@@ -159,6 +162,28 @@
<script type="text/javascript" src="js/firefly.js"></script>
{% block scripts %}{% endblock %}
+<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', '//www.google-analytics.com/analytics.js', 'ga');
+ ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100});
+ ga('send', 'pageview');
+ // send an event if relevant:
+ {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %}
+ ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}');
+ {% endif %}
+ {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %}
+ ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}', '{{ Session.get('gaEventLabel') }}');
+ {% endif %}
+</script>
</body>
</html>
diff --git a/resources/twig/layout/guest.twig b/resources/twig/layout/guest.twig
index e90b550dcd..913fdef851 100644
--- a/resources/twig/layout/guest.twig
+++ b/resources/twig/layout/guest.twig
@@ -59,16 +59,15 @@
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
-
- ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', 'auto');
+ ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100});
ga('send', 'pageview');
-
// send an event if relevant:
- {% if Session.has('gaEventCategory') and Session.has('gaEventAction') %}
+ {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %}
ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}');
{% endif %}
-
+ {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %}
+ ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}','{{ Session.get('gaEventLabel') }}');
+ {% endif %}
</script>
-
</body>
</html>