Difference between revisions of "AppSuite:Metrics-Analytics-Solutions"

(Created page with "== Metrics: Analytics Solutions == === PIWIK === ==== Setup: step-by-step guide ==== With this easy step-by-step guide it should be quite simple to setup PIWIK and adjust...")
 
Line 3: Line 3:
 
=== PIWIK ===
 
=== PIWIK ===
  
 +
Dokumentation about the corresponding front end adapter can be found [[here]]
  
  
Line 11: Line 12:
 
===== 1. Preconditions =====
 
===== 1. Preconditions =====
  
**important**
+
'''important'''
  
 
Please ensure PIWIK runs also on SSL in case OX Appsuite does.
 
Please ensure PIWIK runs also on SSL in case OX Appsuite does.
  
**adblockers**
+
'''adblockers'''
  
 
hint: in case you consider to bypass adblockier mechanisms please avoid suspicious strings for any part of the url (for example ‘piwik’). One possible solution would be to use [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html|apaches mod_rewrite]] or something similar to aliases for affected urls.
 
hint: in case you consider to bypass adblockier mechanisms please avoid suspicious strings for any part of the url (for example ‘piwik’). One possible solution would be to use [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html|apaches mod_rewrite]] or something similar to aliases for affected urls.
Line 30: Line 31:
  
 
<code javascript>
 
<code javascript>
<!-- Piwik -->
+
  <!-- Piwik -->
<script type="text/javascript">
+
  <script type="text/javascript">
  var _paq = _paq || [];
+
    var _paq = _paq || [];
  _paq.push(['trackPageView']);
+
    _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
+
    _paq.push(['enableLinkTracking']);
  (function() {
+
    (function() {
    // in this line you can see the base url that we need to add as property
+
      // in this line you can see the base url that we need to add as property
    var u="//metrics.example.com/piwik/";
+
      var u="//metrics.example.com/piwik/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
+
      _paq.push(['setTrackerUrl', u+'piwik.php']);
    // in this line you can see the site id that we need to add as property
+
      // in this line you can see the site id that we need to add as property
    _paq.push(['setSiteId', 1]);
+
      _paq.push(['setSiteId', 1]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
+
      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);
+
      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="//metrics.open-xchange.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
+
  </script>
<!-- End Piwik Code -->
+
  <noscript><p><img src="//metrics.open-xchange.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" />  
 +
  </p></noscript>
 +
  <!-- End Piwik Code -->
 
</code>
 
</code>
 
===== 4. Appsuite properties =====
 
===== 4. Appsuite properties =====
Line 56: Line 59:
 
</code>
 
</code>
  
**base url**
+
'''base url'''
  
 
You need to specify the base url that allows OX Appsuite calling the PIWIK tracking API. You can simply check if got the right url by trying to open the url followed by ‘piwik.php’ in the browser (example: ‘https:%%//%%metrics.example.com/piwik/piwik.php’). You should see some message similiar to ‘Piwik is a free/libre web analytics that lets you keep control of your data.’
 
You need to specify the base url that allows OX Appsuite calling the PIWIK tracking API. You can simply check if got the right url by trying to open the url followed by ‘piwik.php’ in the browser (example: ‘https:%%//%%metrics.example.com/piwik/piwik.php’). You should see some message similiar to ‘Piwik is a free/libre web analytics that lets you keep control of your data.’
  
 
<code>
 
<code>
//generated PIWIK script//
+
''generated PIWIK script''
  
 
[...]
 
[...]
Line 67: Line 70:
 
[...]
 
[...]
  
//appsuite property//
+
''appsuite property''
 
io.ox/core//tracking/piwik/url=https://metrics.example.com/piwik/
 
io.ox/core//tracking/piwik/url=https://metrics.example.com/piwik/
 
</code>
 
</code>
Line 74: Line 77:
 
With PIWIK you can separate tracking by using different contextes called ‘websites’. These contextes are identified by an unique id that usually starts with 1 and increments by 1 for every newly created page. To guarantee tracked date is added to the right context you have to specify this id in the settings. In case no setting is provided the id ‘1’ is used as default
 
With PIWIK you can separate tracking by using different contextes called ‘websites’. These contextes are identified by an unique id that usually starts with 1 and increments by 1 for every newly created page. To guarantee tracked date is added to the right context you have to specify this id in the settings. In case no setting is provided the id ‘1’ is used as default
  
//generated PIWIK script//
+
''generated PIWIK script''
  
 
<code>
 
<code>
Line 81: Line 84:
 
[...]
 
[...]
 
</code>
 
</code>
//appsuite property//
+
''appsuite property''
  
 
<code>
 
<code>
 
io.ox/core//tracking/piwik/id=1
 
io.ox/core//tracking/piwik/id=1
 
</code>
 
</code>
**enabling/disabling**
+
 
 +
'''enabling/disabling'''
  
 
Finally you need to enable tracking in general and PIWIK in particular.
 
Finally you need to enable tracking in general and PIWIK in particular.

Revision as of 09:36, 22 September 2015

Metrics: Analytics Solutions

PIWIK

Dokumentation about the corresponding front end adapter can be found here


Setup: step-by-step guide

With this easy step-by-step guide it should be quite simple to setup PIWIK and adjust the relevant properties to start tracking.

1. Preconditions

important

Please ensure PIWIK runs also on SSL in case OX Appsuite does.

adblockers

hint: in case you consider to bypass adblockier mechanisms please avoid suspicious strings for any part of the url (for example ‘piwik’). One possible solution would be to use [mod_rewrite] or something similar to aliases for affected urls.

2. Install PIWIK

Simply follow the steps provided by the PIWIK documentation http://piwik.org/docs/installation/

Please pause when you reach step 8 of the wizard (JavaScript Tag) and move on with part 2 of this guide.

3. Take a deeper look at the generated script

The script provided by PIWIK will look like this:

 <script type="text/javascript">
   var _paq = _paq || [];
   _paq.push(['trackPageView']);
   _paq.push(['enableLinkTracking']);
   (function() {
     // in this line you can see the base url that we need to add as property
     var u="//metrics.example.com/piwik/";
     _paq.push(['setTrackerUrl', u+'piwik.php']);
     // in this line you can see the site id that we need to add as property
     _paq.push(['setSiteId', 1]);
     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>

<img src="//metrics.open-xchange.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" />

</noscript>

4. Appsuite properties

Now we have to extract some of the information used in this script. The script itself do not has to be added to OX Appsuite. Use the following file to adjust/add the properties:

 /opt/open-xchange/etc/settings/metrics.properties

base url

You need to specify the base url that allows OX Appsuite calling the PIWIK tracking API. You can simply check if got the right url by trying to open the url followed by ‘piwik.php’ in the browser (example: ‘https:%%//%%metrics.example.com/piwik/piwik.php’). You should see some message similiar to ‘Piwik is a free/libre web analytics that lets you keep control of your data.’

generated PIWIK script

[...] var u="//metrics.example.com/piwik/"; [...]

appsuite property io.ox/core//tracking/piwik/url=https://metrics.example.com/piwik/

    • siteId**

With PIWIK you can separate tracking by using different contextes called ‘websites’. These contextes are identified by an unique id that usually starts with 1 and increments by 1 for every newly created page. To guarantee tracked date is added to the right context you have to specify this id in the settings. In case no setting is provided the id ‘1’ is used as default

generated PIWIK script

[...] _paq.push(['setSiteId', 1]); [...] appsuite property

io.ox/core//tracking/piwik/id=1

enabling/disabling

Finally you need to enable tracking in general and PIWIK in particular.

 io.ox/core//tracking/enabled=true
 io.ox/core//tracking/piwik/enabled=true

5. Continue

Please continue with the PIWIK Installation wizard.