Merge pull request #71 from Gluejar/google_analytics

Google analytics
pull/1/head
Raymond Yee 2012-10-23 10:12:12 -07:00
commit ce382e0673
5 changed files with 26 additions and 15 deletions

View File

@ -1,6 +1,6 @@
def is_preview(request):
from django.conf import settings
return {'jquery_home': settings.JQUERY_HOME, 'jquery_ui_home': settings.JQUERY_UI_HOME, 'is_preview': settings.IS_PREVIEW}
return {'jquery_home': settings.JQUERY_HOME, 'jquery_ui_home': settings.JQUERY_UI_HOME, 'is_preview': settings.IS_PREVIEW, 'show_google_analytics': settings.SHOW_GOOGLE_ANALYTICS}
def count_unseen(request):
from notification.models import Notice, NoticeManager

View File

@ -101,7 +101,11 @@
{% block news %}
<div class="launch_top">
{% if is_preview %}
It's here: our first unglued edition. You can now download <a href="/work/81834/"><I>Oral Literature in Africa</I></a>.<br /><br />Campaigns to unglue more books <a href="http://blog.unglue.it/2012/09/13/update-on-unglue-it-relaunch/">will relaunch soon</a>.
{% else %}
We unglued <a href="/work/81834/">one book</a>. Amazon <a href="http://blog.unglue.it/2012/08/09/open-thread-amazon-forces-unglue-it-to-suspend-crowdfunding-for-creative-commons-ebooks/">shut us down</a>. Now we're back. Help us unglue <a href="https://unglue.it/campaigns/ending">five more books</a>! <br />
{% endif %}
</div>
{% endblock %}
@ -157,7 +161,8 @@
</div>
{% endblock %}
{% block counter %}
<script type="text/javascript">
{% if show_google_analytics %}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28369982-1']);
@ -169,7 +174,8 @@
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</script>
{% endif %}
{% endblock %}
</body>
</html>

View File

@ -427,7 +427,6 @@ def manage_campaign(request, id):
'premium_form' : new_premium_form,
'work': work,
'activetab': activetab,
'is_preview': settings.IS_PREVIEW
})
def googlebooks(request, googlebooks_id):

View File

@ -293,3 +293,6 @@ class NONPROFIT:
is_on = False
name = 'Library Renewal'
link = 'http://127.0.0.1:8000/donate_to_campaign/'
# we should suppress Google Analytics outside of production
SHOW_GOOGLE_ANALYTICS = False

View File

@ -151,3 +151,6 @@ try:
from regluit.settings.local import *
except ImportError:
pass
# we should suppress Google Analytics outside of production
SHOW_GOOGLE_ANALYTICS = True