Skip to content
This repository was archived by the owner on Apr 3, 2022. It is now read-only.

Commit d537afa

Browse files
author
Ryan Arana
committed
Merge pull request #86 from ngoldman/analytics
add analytics
2 parents 7a7ff3e + 1f9d896 commit d537afa

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"leaflet-dist": "~0.7.2",
1515
"angular-ui-router": "~0.2.10",
1616
"angular-md": "~1.0.0",
17-
"marked": "~0.3.2"
17+
"marked": "~0.3.2",
18+
"angulartics": "~0.15.19"
1819
},
1920
"resolutions": {
2021
"marked": "~0.3.2",

static/app/index.html

+13-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
</div>
5252

5353
<div class="navbar-right" ng-cloak>
54-
<button type="button" class="btn btn-create btn-primary navbar-btn pull-left" ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
54+
<button type="button" class="btn btn-create btn-primary navbar-btn pull-left"
55+
analytics-on="click"
56+
analytics-event="Create Geobin"
57+
ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
5558
</div>
5659
</div>
5760
</div>
@@ -69,6 +72,13 @@
6972
</div>
7073
</footer>
7174

75+
<script>
76+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
77+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
78+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
79+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
80+
ga('create', 'UA-44963317-4', 'geobin.io');
81+
</script>
7282
<script src="/static/app/components/jquery/dist/jquery.min.js"></script>
7383
<script src="/static/app/components/tinystore/tinystore.min.js"></script>
7484
<script src="/static/app/components/leaflet-dist/leaflet.js"></script>
@@ -78,6 +88,8 @@
7888
<script src="/static/app/components/angular-ui-router/release/angular-ui-router.min.js"></script>
7989
<script src="/static/app/components/angular-loading-bar/build/loading-bar.min.js"></script>
8090
<script src="/static/app/components/angular-md/dist/angular-md.min.js"></script>
91+
<script src="/static/app/components/angulartics/dist/angulartics.min.js"></script>
92+
<script src="/static/app/components/angulartics/dist/angulartics-ga.min.js"></script>
8193
<script src="/static/app/components/bootstrap/dist/js/bootstrap.min.js"></script>
8294
<script src="/static/app/js/app.js"></script>
8395
<script src="/static/app/js/services.js"></script>

static/app/js/app.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@
77
'Geobin.directives',
88
'Geobin.controllers',
99
'chieffancypants.loadingBar',
10-
'yaru22.md'
10+
'yaru22.md',
11+
'angulartics',
12+
'angulartics.google.analytics'
1113
])
1214

13-
.config(['$locationProvider', '$stateProvider', '$urlRouterProvider',
14-
function ($locationProvider, $stateProvider, $urlRouterProvider) {
15+
.config(['$locationProvider', '$stateProvider', '$urlRouterProvider', '$analyticsProvider',
16+
function ($locationProvider, $stateProvider, $urlRouterProvider, $analyticsProvider) {
1517
$locationProvider.html5Mode(true);
1618

19+
// analytics
20+
// prevent double reporting of initial pageview
21+
// drawback is redirects are not tracked (e.g. /api/asdf -> /doc/api)
22+
$analyticsProvider.firstPageview(false);
23+
1724
// Redirects
1825
$urlRouterProvider.when(/^\/api(.*)?/, '/doc/api');
1926
$urlRouterProvider.otherwise('/');
@@ -62,12 +69,4 @@
6269
}
6370
]);
6471

65-
// temporary tooltip workaround
66-
// @TODO: replace jquery/bootstrap elements w/ angularUI
67-
// http://angular-ui.github.io/bootstrap/
68-
// $('body').tooltip({
69-
// container: 'body',
70-
// selector: '[data-toggle=tooltip]'
71-
// });
72-
7372
})();

static/app/partials/list.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ <h4><i class="fa fa-warning"></i> Geobin "{{binId}}" Not Found!</h4>
6868
<p>Either this bin has expired, or it never existed! Either way there's nothing to see here. You can either go back home or create a new geobin.</p>
6969
<hr>
7070
<p>
71-
<button type="button" class="btn btn-primary" ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
71+
<button type="button" class="btn btn-primary"
72+
analytics-on="click"
73+
analytics-event="Create Geobin (expired)"
74+
ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
7275
<a href="/" class="btn btn-link"><i class="fa fa-home"></i> Go Back Home</a>
7376
</p>
7477
</div>

0 commit comments

Comments
 (0)