Blame view

README.md 1.52 KB
9b0f6f245   Fernando Ribeiro   Added the README....
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  To add piwik (statistics access for openaire)
  
  In the footer add the following code:
  
        <%@ page import="org.dspace.core.ConfigurationManager" %>
        <%@ page import="org.dspace.content.Item" %>
  
        <%
  
        String piwikID = ConfigurationManager.getProperty("piwik.id");
        String baseUrl = ConfigurationManager.getProperty("dspace.hostname");
        String handle;
  
  
        try{
        Item item = (Item) request.getAttribute("item");
  
        // get the handle if the item has one yet
        handle = item.getHandle();
        }
        catch(Exception e){
        	handle = null;
        	//e.printstacktrace();
        }
  
        %>
  
        <!-- Piwik -->
        <script type="text/javascript">
          var _paq = _paq || [];
          _paq.push(['trackPageView']);
          _paq.push(['enableLinkTracking']);
          (function() {
            var u="//analytics.openaire.eu/";
            _paq.push(['setTrackerUrl', u+'piwik.php']);
            _paq.push(['setSiteId', <%=piwikID%>]);
            <% if(handle != null){%>
            	_paq.push(['setCustomVariable', 1, 'oaipmhID',"oai:<%= baseUrl %>/<%=handle %>", 'page']);
            <%}%>
            var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
            g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
          })();
        </script>
        <noscript><p><img src="//analytics.openaire.eu/piwik.php?idsite=<%=piwikID%>" style="border:0;" alt="" /></p></noscript>
ab39f20c6   Fernando Ribeiro   Corrected typo in...
45
  And in the build.properties add the piwik.id of the institution.