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

Commit

Permalink
Merge pull request #86 from ngoldman/analytics
Browse files Browse the repository at this point in the history
add analytics
  • Loading branch information
Ryan Arana committed Jul 3, 2014
2 parents 7a7ff3e + 1f9d896 commit d537afa
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"leaflet-dist": "~0.7.2",
"angular-ui-router": "~0.2.10",
"angular-md": "~1.0.0",
"marked": "~0.3.2"
"marked": "~0.3.2",
"angulartics": "~0.15.19"
},
"resolutions": {
"marked": "~0.3.2",
Expand Down
14 changes: 13 additions & 1 deletion static/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
</div>

<div class="navbar-right" ng-cloak>
<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>
<button type="button" class="btn btn-create btn-primary navbar-btn pull-left"
analytics-on="click"
analytics-event="Create Geobin"
ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
</div>
</div>
</div>
Expand All @@ -69,6 +72,13 @@
</div>
</footer>

<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', 'UA-44963317-4', 'geobin.io');
</script>
<script src="/static/app/components/jquery/dist/jquery.min.js"></script>
<script src="/static/app/components/tinystore/tinystore.min.js"></script>
<script src="/static/app/components/leaflet-dist/leaflet.js"></script>
Expand All @@ -78,6 +88,8 @@
<script src="/static/app/components/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="/static/app/components/angular-loading-bar/build/loading-bar.min.js"></script>
<script src="/static/app/components/angular-md/dist/angular-md.min.js"></script>
<script src="/static/app/components/angulartics/dist/angulartics.min.js"></script>
<script src="/static/app/components/angulartics/dist/angulartics-ga.min.js"></script>
<script src="/static/app/components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/static/app/js/app.js"></script>
<script src="/static/app/js/services.js"></script>
Expand Down
21 changes: 10 additions & 11 deletions static/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@
'Geobin.directives',
'Geobin.controllers',
'chieffancypants.loadingBar',
'yaru22.md'
'yaru22.md',
'angulartics',
'angulartics.google.analytics'
])

.config(['$locationProvider', '$stateProvider', '$urlRouterProvider',
function ($locationProvider, $stateProvider, $urlRouterProvider) {
.config(['$locationProvider', '$stateProvider', '$urlRouterProvider', '$analyticsProvider',
function ($locationProvider, $stateProvider, $urlRouterProvider, $analyticsProvider) {
$locationProvider.html5Mode(true);

// analytics
// prevent double reporting of initial pageview
// drawback is redirects are not tracked (e.g. /api/asdf -> /doc/api)
$analyticsProvider.firstPageview(false);

// Redirects
$urlRouterProvider.when(/^\/api(.*)?/, '/doc/api');
$urlRouterProvider.otherwise('/');
Expand Down Expand Up @@ -62,12 +69,4 @@
}
]);

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

})();
5 changes: 4 additions & 1 deletion static/app/partials/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ <h4><i class="fa fa-warning"></i> Geobin "{{binId}}" Not Found!</h4>
<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>
<hr>
<p>
<button type="button" class="btn btn-primary" ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
<button type="button" class="btn btn-primary"
analytics-on="click"
analytics-event="Create Geobin (expired)"
ng-click="create()"><i class="fa fa-magic"></i> Create a New Geobin</button>
<a href="/" class="btn btn-link"><i class="fa fa-home"></i> Go Back Home</a>
</p>
</div>

0 comments on commit d537afa

Please sign in to comment.