Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DS-1190] Google Analytics tracking support for JSPUI #44

Merged
2 commits merged into from Aug 7, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
String extraHeadData = (String)request.getAttribute("dspace.layout.head");
String dsVersion = Util.getSourceVersion();
String generator = dsVersion == null ? "DSpace" : "DSpace "+dsVersion;
String analyticsKey = ConfigurationManager.getProperty("jspui.google.analytics.key");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -80,6 +81,27 @@
<script type="text/javascript" src="<%= request.getContextPath() %>/static/js/scriptaculous/builder.js"> </script>
<script type="text/javascript" src="<%= request.getContextPath() %>/static/js/scriptaculous/controls.js"> </script>
<script type="text/javascript" src="<%= request.getContextPath() %>/static/js/choice-support.js"> </script>

<%--Gooogle Analytics recording.--%>
<%
if (analyticsKey != null && analyticsKey.length() > 0)
{
%>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<%= analyticsKey %>']);
_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>
<%
}
%>

</head>

<%-- HACK: leftmargin, topmargin: for non-CSS compliant Microsoft IE browser --%>
Expand Down
10 changes: 10 additions & 0 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,16 @@ webui.suggest.enable = false
#
# webui.session.invalidate = true

# If you would like to use google analytics to track general website statistics then
# use the following parameter to provide your analytics key. First sign up for an
# account at http://analytics.google.com, then create an entry for your repositories
# website. Analytics will give you a snipit of javascript code to place on your site,
# inside that snip it is your google analytics key usually found in the line:
# _uacct = "UA-XXXXXXX-X"
# Take this key (just the UA-XXXXXX-X part) and place it here in this parameter.
# jspui.google.analytics.key=UA-XXXXXX-X


#---------------------------------------------------------------#
#--------------XMLUI SPECIFIC CONFIGURATIONS--------------------#
#---------------------------------------------------------------#
Expand Down