Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding production flag for GA snippets:

  {% PRODUCTION %} will be true in templates when built
  with `python manage.py build --production`
  • Loading branch information...
commit 99a6ad6daa07af13d1bf2d7614283df8d23b3b9e 1 parent 25ca3af
@stenington stenington authored
Showing with 8 additions and 2 deletions.
  1. +4 −2 templates/base.html
  2. +4 −0 vendor/hackasaurus/management.py
View
6 templates/base.html
@@ -12,7 +12,8 @@
<link rel="stylesheet" href="/css/desktop.css" />
<![endif]-->
{% block head %} {% endblock %}
- <script type="text/javascript">
+ {% if PRODUCTION %}
+ <script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35433268-10']);
_gaq.push(['_setDomainName', 'openbadges.org']);
@@ -22,7 +23,8 @@
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>
+ {% endif %}
</head>
<body>
<script>
View
4 vendor/hackasaurus/management.py
@@ -35,6 +35,8 @@ def cmd_compilemessages(args):
def cmd_build(args):
"build static site"
+ template_vars['PRODUCTION'] = args.production
+
tinysite.export_site(
build_dir=build_dir,
static_files_dir=static_files_dir,
@@ -62,6 +64,8 @@ def cmd_runserver(args):
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
build = subparsers.add_parser('build', help=cmd_build.__doc__)
+ build.add_argument('--production', help='build for production environment',
+ action='store_true');
build.set_defaults(func=cmd_build)
makemessages = subparsers.add_parser('makemessages',
help=cmd_makemessages.__doc__)
Please sign in to comment.
Something went wrong with that request. Please try again.