Commits

Steve Losh committed b844078

Support Analytics IDs.

Comments (0)

Files changed (2)

bookmarkdown/bookmarkdown

 base_context = {
     'book_title': getattr(config, 'title', ''),
     'author': getattr(config, 'author', ''),
-    'author_url': getattr(config, 'author_url', ''),}
+    'author_url': getattr(config, 'author_url', ''),
+    'ga_id': getattr(config, 'ga_id', ''),
+    'gauges_id': getattr(config, 'gauges_id', ''),
+}
 # }}}
 
 # Utilities ------------------------------------------------------------------------

bookmarkdown/templates/base.html

             </footer>
         </div>
 
-        <script type="text/javascript">
+        {% if ga_id %}
+            <script type="text/javascript">
+                var _gaq = _gaq || [];
+                _gaq.push(['_setAccount', '{{ ga_id }}']);
+                _gaq.push(['_trackPageview']);
 
-            var _gaq = _gaq || [];
-            _gaq.push(['_setAccount', 'UA-15328874-8']);
-            _gaq.push(['_trackPageview']);
+                (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>
+        {% endif %}
 
-            (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 type="text/javascript">
-             var _gauges = _gauges || [];
-             (function() {
-              var t   = document.createElement('script');
-              t.type  = 'text/javascript';
-              t.async = true;
-              t.id    = 'gauges-tracker';
-              t.setAttribute('data-site-id', '4e8f83b7f5a1f546e200000d');
-              t.src = '//secure.gaug.es/track.js';
-              var s = document.getElementsByTagName('script')[0];
-              s.parentNode.insertBefore(t, s);
-              })();
-          </script>
+        {% if gauges_id %}
+            <script type="text/javascript">
+                var _gauges = _gauges || [];
+                (function() {
+                 var t   = document.createElement('script');
+                 t.type  = 'text/javascript';
+                 t.async = true;
+                 t.id    = 'gauges-tracker';
+                 t.setAttribute('data-site-id', '{{ gauges_id }}');
+                 t.src = '//secure.gaug.es/track.js';
+                 var s = document.getElementsByTagName('script')[0];
+                 s.parentNode.insertBefore(t, s);
+                 })();
+             </script>
+        {% endif %}
     </body>
 </html>