Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Commit

Permalink
Extract ga.js tracking id
Browse files Browse the repository at this point in the history
  • Loading branch information
levent committed Feb 9, 2015
1 parent 481edff commit 4effa49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
27 changes: 11 additions & 16 deletions app/views/shared/_google_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<% if Rails.env == "production" %>
<script type="text/javascript">
<% if Rails.env == "production" && ENV['google_analytics_tracking_id' %>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2222612-1']);
_gaq.push(['_setDomainName', 'agileista.com']);
_gaq.push(['_trackPageview']);
var _gaq = _gaq || [];
_gaq.push(['_setAccount', ENV['google_analytics_tracking_id']]);
_gaq.push(['_trackPageview']);

<% if defined?(@project) %>
_gaq.push(['_setCustomVar', 1, 'Project', '<%= @project.id %>', 3 ]);
<% end %>
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</script>
<% end %>
12 changes: 1 addition & 11 deletions config/application.yml.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
# Add configuration values here, as shown below.
#
# pusher_app_id: "2954"
# pusher_key: 7381a978f7dd7f9a1117
# pusher_secret: abdc3b896a0ffb85d373
# stripe_api_key: sk_test_2J0l093xOyW72XUYJHE4Dv2r
# stripe_publishable_key: pk_test_ro9jV5SNwGb1yYlQfzG17LHK
#
# production:
# stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H
# stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU
admin_email: lebreeze@gmail.com
devise_secret_key: e7606827fa0b824ed1b4e93751a52bdefe73fb31ed5d7c2922be578e8b0dd5ded2720c90122e011fc0edce8687eb4974a8d696bf9bc72e91c8aeacd69f59067d00a7
sse_token: 5dc56ac44daab5732ad07b117f781998ab6d891244a1190324e7502efe426b9f49e8644b685e10493b6e2c5cb5845e690c44
google_analytics_tracking_id: UA-XXXXX-1

0 comments on commit 4effa49

Please sign in to comment.