Spot analytics

From MPDLMediaWiki
Jump to navigation Jump to search


Direct Link[edit]

Configuration[edit]

  • 1 Copy the following snippet (!!! THIS SNIPPET WORKS ONLY FOR SPOT!!!):
<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["setCustomVariable", 1, "Institute (from IP)", document.getElementById("instituteNameForIP").value, "visit"]);
  _paq.push(["setCustomVariable", 2, "Institute ID (from IP)", document.getElementById("instituteIdForIP").value, "visit"]);
  if(document.getElementById("instituteNameForUser").value != ''){
    	_paq.push(["setCustomVariable", 3, "User organization (logged in)", document.getElementById("instituteNameForUser").value, "visit"]);
  }
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//analytics.mpdl.mpg.de/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 34]);
    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.mpdl.mpg.de/piwik.php?idsite=34" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

Implementation[edit]

  • Analytics are done via Piwik by including the javascript tracking code (see [1]). Default analytics are generated automaticcaly
  • For further analytics, we use the [piwik.org/docs/custom-variables/ custom variables] mechanism:
    • Institute (from IP) : Give the institute name according to the IP (see [2]) of the user
    • Institute ID (from IP): Give the institute ID according to the IP (see [3]) of the user
    • User organization (logged in): Give the name of the first Organization of the imeji user (i.e only for logged in users) as defined in imeji

IP tracking[edit]

  • IMPORTANT: No IP will recorded. Piwik uses traoncated IPs, and imeji just read the IP to get the Institute of the user
  • For the mapping of IP of MPIs IP and names, we use supported by MPDL resource: http://www2.mpdl.mpg.de/seco-irmapubl/expoipra_mpi?style=expo01
    • NOTE: Correct processing the list by imeji and piwik from IPs, other than MPDL IP range, can be tested in open library of Max-Planck-Institut für Sozialrecht und Sozialpolitik (4th Stock).
  • When a new User comes into spot, imeji reads the IP and check if the IP is belongs to one MPI (according to the previous list)

Testing issues[edit]