28 Ekim 2016 Cuma

Dspace and Piwik Integration

Piwik definition from the FAQ of piwik.org is as below.
Piwik is a downloadable, Free (GPL licensed) web analytics software platform. It provides detailed reports on your website and its visitors, including the search engines and keywords they used, the language they speak, which pages they like, the files they download and so much more. Piwik aims to be an open source alternative to Google Analytics. Piwik is PHP MySQL software which you download and install on your own webserver. At the end of the 5-minute installation process you will be given a JavaScript tag. Simply copy and paste this tag on websites you wish to track (or use an existing plugin to do it automatically for you).
 After installation and configuration of piwik you can track  visitors analytics of your institutional repo. If you want to embed these analytics into Dspace you can use the widgets of Piwik.  There are three places that you can embed the analytics.

1-)By adding iframe widget code into Community/Collection introductory, news html sections
2-)By adding iframe  widget code into page-structure.xsl
3-)By adding iframe widgt code into item-view.xsl

First method is the easiest method. You go the widgets menu through the admin panel of Piwik and get the iframe embed code.


Then you go to a collection/community and edit which you want to add the widget as below.

Then update the collection/community and that's it.  You will see the analytics in the community/collection page. But one more point is missing the widget will show whole analytics of your DSpace repo. You should segment  analytics that will only reflect the analytics  of the collection/community you want. To do that you can use page-url parameter with the url of the community/collection. Let's assume that your collection url is
                  
http://dspace.university.edu/handle/11111/23 

Then you should add the following code to the widget code

segment=pageUrl%3D%3Dhttp%253A%252F%252Fdspace.university.edu%252Fhandle%252F11111%252F23

You should add this after the yesterday keyword of the embed code then the iframe code will become as below



The second and third method are nearly same but the places are different. If you want to add analytics to all pages you should use page-structure.xsl. But if you want to only add an analytic to item pages you should use the item-view.xsl. Now let's pass to the method. Open page-structure.xsl or item-view.xsl with your favorite editor (mine is nano) and add the following template codes to the xsl file. Lets add an realtime map to all pages in the header part of Dspace.


nano /dspace/webapps/xmlui/themes/Mirage2/xsl/core/page-structure.xsl

We add the template call code after the following lines




offcanvas
row-offcanvas-right">

 <xsl:call-template name ="realtimemap"/>


then in the bottom of the page we will define the template. 


 
Attention you should all change & characters with & in xsl files in the iframe embed code!
You have noticed that there is variable {$piwik-uri} in the embed code segmentation part. This is the url variable that you should define in the global-variables.xsl as below ,




Then you will see the realtime on all pages of your Dspace.








Hiç yorum yok:

Yorum Gönder

İzleyiciler