diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statistics/Navigation.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statistics/Navigation.java index e8ac32a6efcd..4f05d84a5090 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statistics/Navigation.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statistics/Navigation.java @@ -21,6 +21,7 @@ import org.apache.cocoon.caching.CacheableProcessingComponent; import org.apache.excalibur.source.SourceValidity; import org.apache.excalibur.source.impl.validity.NOPValidity; +import org.dspace.core.ConfigurationManager; import org.dspace.core.Constants; import org.dspace.core.Context; import org.dspace.services.ConfigurationService; @@ -33,6 +34,8 @@ import java.io.IOException; import java.sql.SQLException; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + /** * Navigation Elements for viewing statistics related to Items. * @@ -113,12 +116,15 @@ public void addOptions(Options options) throws SAXException, WingException, UIEx } } - // ufal - this is called only for authorised with admin rights (e.g., admin rights to a community/collection) - if(dso != null && dso.getHandle() != null){ - statistics.addItemXref(contextPath + "/handle/" + dso.getHandle() + "/statistics-google", T_statistics_ga_head); - }else { - statistics.addItemXref(contextPath + "/statistics-google", T_statistics_ga_head); - } + //show ga link only if we have a key file set + if(isNotBlank(ConfigurationManager.getProperty("lr", "lr.ga.analytics.key.file"))) { + // ufal - this is called only for authorised with admin rights (e.g., admin rights to a community/collection) + if (dso != null && dso.getHandle() != null) { + statistics.addItemXref(contextPath + "/handle/" + dso.getHandle() + "/statistics-google", T_statistics_ga_head); + } else { + statistics.addItemXref(contextPath + "/statistics-google", T_statistics_ga_head); + } + } } protected boolean displayStatsType(Context context, String type, DSpaceObject dso) throws SQLException {