summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/nimweb.nim8
-rw-r--r--tools/website.tmpl4
2 files changed, 10 insertions, 2 deletions
diff --git a/tools/nimweb.nim b/tools/nimweb.nim
index 74f561b52..0cf19096d 100644
--- a/tools/nimweb.nim
+++ b/tools/nimweb.nim
@@ -23,6 +23,7 @@ type
     gitCommit: string
     quotations: Table[string, tuple[quote, author: string]]
     numProcessors: int # Set by parallelBuild:n, only works for values > 0.
+    gaId: string  # google analytics ID, nil means analytics are disabled
   TRssItem = object
     year, month, day, title: string
   TAction = enum
@@ -144,7 +145,12 @@ proc parseCmdLine(c: var TConfigData) =
         c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
       of "website": action = actOnlyWebsite
       of "pdf": action = actPdf
-      else: quit(usage)
+      of "googleanalytics":
+        c.gaId = val
+        c.nimArgs.add("--doc.googleAnalytics:" & val & " ")
+      else:
+        echo("Invalid argument $1" % [key])
+        quit(usage)
     of cmdEnd: break
   if c.infile.len == 0: quit(usage)
 
diff --git a/tools/website.tmpl b/tools/website.tmpl
index 6f7a216a5..2197e361c 100644
--- a/tools/website.tmpl
+++ b/tools/website.tmpl
@@ -192,13 +192,15 @@ View at: localhost:5000
 		</footer>

 

   <script>
+#  if c.gaId != nil:
     (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', 'UA-48159761-1', 'nim-lang.org');
+    ga('create', '${c.gaId}', 'nim-lang.org');
     ga('send', 'pageview');
+#  end if
 
 var timer;
 var prevIndex = 0;