Skip to content

Commit

Permalink
add google analytics to as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
JAMES ZHANG committed Apr 20, 2016
1 parent 1dc6841 commit 5f21f4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ var toneAnalyzer = watson.tone_analyzer({

app.get('/', function(req, res) {
res.render('index');
res.render('index', {
ga: process.env.GOOGLE_ANALYTICS
});
});

app.post('/api/tone', function(req, res, next) {
Expand Down
9 changes: 9 additions & 0 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,15 @@
<script type="text/javascript" src="js/components/helpers.js"></script>
<script type="text/javascript" src="js/components/App.js"></script>
<script type="text/javascript" src="js/demo.js"></script>
<script type="text/javascript">
(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', '<$= ga $>', 'auto');
ga('send', 'pageview');
</script>
</body>

</html>

0 comments on commit 5f21f4c

Please sign in to comment.