Skip to content

Commit

Permalink
google analytics!
Browse files Browse the repository at this point in the history
  • Loading branch information
Blair Anderson committed Mar 29, 2015
1 parent e5bbbd7 commit 90baced
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GOOGLE_ANALYTICS='UA-61052500-2'
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ end


group :development, :test do
gem 'dotenv-rails'

# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ GEM
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
diff-lcs (1.2.5)
dotenv (1.0.2)
dotenv-rails (1.0.2)
dotenv (= 1.0.2)
erubis (2.7.0)
execjs (2.3.0)
factory_girl (4.5.0)
Expand Down Expand Up @@ -225,6 +228,7 @@ PLATFORMS
DEPENDENCIES
bootstrap-sass (~> 3.3.3)
byebug
dotenv-rails
factory_girl_rails
faker
jquery-rails
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ I think this is why wordpress is SO popular. Its stupid-easy to fire-up, and cha
- A user can login and logout
- A user can submit a new item
- A user can like/unlike an item
- Google Analytics Integration


### Deploy?

[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)

*[learn more about](https://devcenter.heroku.com/articles/app-json-schema)*

### Change the Code!!!

My main goal for this is to give new programmers some code to look at and talk about. Anytime i [get questions](/issues), I plan to add them here...
My main goal for this is to give new programmers some code to look at and talk about. Anytime i [get questions](https://github.com/blairanderson/rails-hackernews-reddit-producthunt-clone/issues), I plan to add them here...

*Open your terminal*

Expand Down
6 changes: 5 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"description": "Ruby on Rails application that mimics social news link sharing websites like HackerNews, ProductHunt, and Reddit.",
"repository": "github.com:blairanderson/rails-hackernews-reddit-producthunt-clone",
"logo": "https://cdn.rawgit.com/blairanderson/rails-hackernews-reddit-producthunt-clone/master/public/rrhnclone.png",
"keywords": ["rails", "ruby-on-rails", "hackernews", "producthunt", "reddit"]
"keywords": ["rails", "ruby-on-rails", "hackernews", "producthunt", "reddit"],
"website": "http://www.blairanderson.co/rails-hackernews-reddit-producthunt-clone/",
"env": {
"GOOGLE_ANALYTICS": "UA-12345432-2"
}
}
11 changes: 11 additions & 0 deletions app/views/components/_google_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% if ENV["GOOGLE_ANALYTICS"] %>
<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["GOOGLE_ANALYTICS"] %>, 'auto');
ga('send', 'pageview');
</script>
<% end %>
4 changes: 4 additions & 0 deletions app/views/components/_login_register.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

<h1>Start Your Own Link Sharing Community!</h1>
<h5>Immediately start signing people up and let them share links and more!</h5>
<div>
<iframe src="https://ghbtns.com/github-btn.html?user=blairanderson&repo=rails-hackernews-reddit-producthunt-clone&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=blairanderson&repo=rails-hackernews-reddit-producthunt-clone&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="158px" height="30px"></iframe>
</div>
<% @user ||= User.new %>
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
Expand Down
7 changes: 4 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>RailsHackernewsRedditProducthunt</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<title>Rails Hackernews Reddit Producthunt Clone Github</title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
</head>
<body style="padding-top:70px">
Expand All @@ -16,6 +16,7 @@
</div>
</div>

<%= render 'components/google_analytics' %>
<%= yield :javascripts %>
</body>

Expand Down

0 comments on commit 90baced

Please sign in to comment.