(Scott Phillips) Added easy support for google analytics statistics, if you want to use analytics simple provide your key in the parameter "xmlui.google.analytics.key".

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2896 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Scott Phillips
2008-04-14 18:37:31 +00:00
parent 3f0d3639c7
commit 616a4f0221
4 changed files with 38 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.xml.sax.SAXException;
/**
@@ -214,6 +215,13 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
pageMeta.addMetadata("request","serverName").addContent(request.getServerName());
pageMeta.addMetadata("request","URI").addContent(request.getSitemapURI());
String analyticsKey = ConfigurationManager.getProperty("xmlui.google.analytics.key");
if (analyticsKey != null && analyticsKey.length() > 0)
{
analyticsKey = analyticsKey.trim();
pageMeta.addMetadata("google","analytics").addContent(analyticsKey);
}
// Add metadata for quick searches:
pageMeta.addMetadata("search", "simpleURL").addContent(
contextPath + "/search");

View File

@@ -228,6 +228,18 @@
 
</script>
</xsl:for-each>
<!-- Add a google analytics script if the key is present -->
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='google'][@qualifier='analytics']">
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"><xsl:text>&#160;</xsl:text></script>
<script type="text/javascript">
<xsl:text>_uacct = "</xsl:text><xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='google'][@qualifier='analytics']"/><xsl:text>";</xsl:text>
<xsl:text>urchinTracker();</xsl:text>
</script>
</xsl:if>
<!-- Add the title in -->
<xsl:variable name="page_title" select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='title']" />
<title>

View File

@@ -1203,6 +1203,15 @@ webui.suggest.enable = false
#xmlui.bitstream.mods = true
#xmlui.bitstream.mets = 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 ushually found in the line:
# _uacct = "UA-XXXXXXX-X"
# Take this key (just the UA-XXXXXX-X part) and place it here in this parameter.
#xmlui.google.analytics.key=UA-XXXXXX-X
#---------------------------------------------------------------#
#--------------OAI-PMH SPECIFIC CONFIGURATIONS------------------#
#---------------------------------------------------------------#

View File

@@ -862,6 +862,15 @@ More information is provide below in <a href="#newfilter">Creating a new Media/F
<td>Determine where a user is directed after logging into the system. Leave this parameter blank or undefined to direct users to the repository homepage, or "/profile" for the user's profile, or another reasonable choice is "/submissions" to see if the user has any tasks awaiting their attention. The default is the repository home page.</td>
</tr>
<tr>
<td><code>xmlui.google.analytics.key</code></td>
<td><code>UA-XXXXXXX-X</code></td>
<td>If you would like to use google analytics to track general website statistics then provide your google analytics key in this parameter. First sign up for an account at <a href="http://analytics.google.com">http://analytics.google.com</a>, 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, "<code>_uacct = 'UA-XXXXXXX-X'</code>" Take this key (just the <code>UA-XXXXXX-X</code> part) and place it here in this parameter.</td>
</tr>
<tr>
<td><code>xmlui.force.ssl</code></td>