Skip to content

Commit f23ff20

Browse files
committed
google analytics configuration moved to application.conf
1 parent 551f553 commit f23ff20

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

app/controllers/BirdWatch.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ object BirdWatch extends Controller {
2525
val queryDefaults = "&default_field:text$default_operator:AND&sort=id:desc"
2626

2727
/** Controller action serving single page application */
28-
def index = Action { Ok(views.html.index()) }
28+
def index = Action {
29+
Ok(views.html.index(Conf.getOrEmpty("ga.hostname"), Conf.getOrEmpty("ga.domain"), Conf.getOrEmpty("ga.id")))
30+
}
2931

3032
/** Controller Action serving Tweets as JSON going backwards in time. Query passed in as JSON */
3133
def search = Action.async(parse.json) {

app/views/index.scala.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@(hostname: String, domain: String, id: String)
12
<!DOCTYPE html>
23

34
<html lang="en">
@@ -138,14 +139,14 @@ <h6>Word Frequency</h6>
138139

139140
<!-- Scripts placed at the end of the document so the pages load faster -->
140141

141-
<script src="/assets/javascripts/vendor/jquery-1.9.1.js"></script>
142+
<script src="/assets/javascripts/vendor/jquery-1.10.2.min.js"></script>
142143
<script src="/assets/javascripts/vendor/angular.min.js"></script>
143-
<script src="/assets/javascripts/vendor/d3.js"></script>
144+
<script src="/assets/javascripts/vendor/d3.v3.min.js"></script>
144145

145146
<script src="/assets/javascripts/vendor/d3.layout.cloud.js"></script>
146147
<script src="/assets/javascripts/vendor/moment.min.js"></script>
147148
<script src="/assets/javascripts/vendor/crossfilter.v1.min.js"></script>
148-
<script src="/assets/javascripts/vendor/underscore.js"></script>
149+
<script src="/assets/javascripts/vendor/underscore.min.js"></script>
149150
<script src="/assets/javascripts/vendor/rickshaw.min.js"></script>
150151

151152
<script src="/assets/javascripts/ui-bootstrap-custom.js"></script>
@@ -164,12 +165,12 @@ <h6>Word Frequency</h6>
164165

165166
<!-- Analytics, Todo: replace or remove in your own project. -->
166167
<script>
167-
if ( location.hostname === 'birdwatch.matthiasnehlsen.com' ) {
168+
if (location.hostname === '@hostname'){
168169
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
169170
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
170171
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
171172
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
172-
ga('create', 'UA-40261983-2', 'matthiasnehlsen.com');
173+
ga('create', '@id', '@domain');
173174
ga('send', 'pageview');
174175
}
175176
</script>

conf/application.conf

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ application.topics="1Pr0grammer,akka,angularjs,bigdata,cassandra,clojure,couchba
2929

3030
application.instanceID="birdwatch1"
3131

32-
33-
32+
# google analytics configuration
33+
ga.hostname="birdwatch.matthiasnehlsen.com"
34+
ga.domain="matthiasnehlsen.com"
35+
ga.id="UA-40261983-2"

0 commit comments

Comments
 (0)