src/hg/lib/googleAnalytics.c 1.5
1.5 2010/04/01 05:53:37 markd
Allow empty key to analyticsKey to disable google analytics (for overriding when one hg.conf
includes another).
Index: src/hg/lib/googleAnalytics.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/googleAnalytics.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -B -U 1000000 -r1.4 -r1.5
--- src/hg/lib/googleAnalytics.c 16 May 2008 19:04:40 -0000 1.4
+++ src/hg/lib/googleAnalytics.c 1 Apr 2010 05:53:37 -0000 1.5
@@ -1,35 +1,35 @@
#include "common.h"
#include "hgConfig.h"
#include "hPrint.h"
#include "googleAnalytics.h"
static char const rcsid[] = "$Id$";
void googleAnalytics()
/* check for analytics configuration item and output google hooks if OK */
{
static boolean done = FALSE;
if (done)
return;
done = TRUE; /* do not repeat this by mistake */
char *analyticsKey = cfgOption("analyticsKey");
-/* if config is missing, nothing happens here */
-if (NULL == analyticsKey)
+/* if config is missing or empty, nothing happens here */
+if (isEmpty(analyticsKey))
return;
hPrintf("\n<script type=\"text/javascript\">\n"
"var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n"
"document.write(unescape(\"%%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%%3E%%3C/script%%3E\"));\n"
"</script>\n"
"<script type=\"text/javascript\">\n"
"var pageTracker = _gat._getTracker(\"%s\");\n"
"pageTracker._initData();\n"
"pageTracker._trackPageview();\n"
"</script>\n", analyticsKey);
}