From 3d86007c7c8ee2f9ff29a26903d10aab32cd5389 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Tue, 4 Nov 2014 10:31:15 -0500 Subject: [PATCH] initial commit of google analytics tracking for toolshed --- config/tool_shed.ini.sample | 6 ++++++ lib/galaxy/webapps/tool_shed/config.py | 2 ++ templates/webapps/tool_shed/base_panels.mako | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/config/tool_shed.ini.sample b/config/tool_shed.ini.sample index 029f437e82a..23b15b16e65 100644 --- a/config/tool_shed.ini.sample +++ b/config/tool_shed.ini.sample @@ -46,6 +46,12 @@ session_data_dir = %(here)s/database/beaker_sessions session_key = galaxysessions session_secret = changethisinproduction +# -- Analytics + +# You can enter tracking code here to track visitor's behavior +# through your Google Analytics account. Example: UA-XXXXXXXX-Y +#ga_code = None + # -- Users and Security # Galaxy encodes various internal values when these values will be output in diff --git a/lib/galaxy/webapps/tool_shed/config.py b/lib/galaxy/webapps/tool_shed/config.py index 9da0e1ef886..4d097227720 100644 --- a/lib/galaxy/webapps/tool_shed/config.py +++ b/lib/galaxy/webapps/tool_shed/config.py @@ -40,6 +40,8 @@ class Configuration( object ): self.database_connection = kwargs.get( "database_connection", False ) self.database_engine_options = get_database_engine_options( kwargs ) self.database_create_tables = string_as_bool( kwargs.get( "database_create_tables", "True" ) ) + # Analytics + self.ga_code = kwargs.get( "ga_code", None ) # Where dataset files are stored self.file_path = resolve_path( kwargs.get( "file_path", "database/community_files" ), self.root ) self.new_file_path = resolve_path( kwargs.get( "new_file_path", "database/tmp" ), self.root ) diff --git a/templates/webapps/tool_shed/base_panels.mako b/templates/webapps/tool_shed/base_panels.mako index 60c643af483..f9435a6d9b1 100644 --- a/templates/webapps/tool_shed/base_panels.mako +++ b/templates/webapps/tool_shed/base_panels.mako @@ -10,6 +10,17 @@ ## Masthead <%def name="masthead()"> + %if app.config.ga_code: + + %endif + ## start main tag