Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
preeti_pradhan
Explorer
0 Kudos

Introduction :

Piwik is an open analytics platform currently used by individuals, companies and governments all over the world.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.

In today’s analytics world, SAP Enterprise portal website can use analytic tool like PIWIK to track site usage.

Many times, we need to have information on atleast one of the following for our SAP EP Website:

•         Measure site activity

•         Analyze User behavior

•         Visitors' tracking.

•         Analysis of the contents visited (pages, files).

•         Information of the visitors (Browsers, Operating System).

PIWIK provides us with the tag to be used for hitting their server. This tag needs to be on all the pages , we need to track in SAP Portal. Since SAP Portal has many pages/iViews, the script needs to be added to a common place.

In SAP Portal versions 7.0 , we can add the code to Desktop innerpage . If you want to use analytics tool in this version refer my Document : http://scn.sap.com/docs/DOC-39121

However in SAP Portal 7.3 and above, the default framework page is Ajax framework page and there is no concept of Desktop innerpage for it.Hence we need to change the com.sap.portal.navigation.contentarea.war file and add the piwik code in this war file.

Implementation Steps :

1)       We need to get the PIWIK tag for each Portal URL. This will be provided by PIWIK team.

<!-- Piwik -->

<script type="text/javascript">

var pkBaseURL = "<PIWIK server URL>”;

document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));

</script><script type="text/javascript">

try {

var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 764);

var csusername = 'anonymous';

piwikTracker.setCustomData({'csusername': csusername});

piwikTracker.trackPageView();

piwikTracker.enableLinkTracking();

} catch( err ) {}

</script> <!-- End Piwik Tracking Code -->

2)       Download the com.sap.portal.navigation.contentarea.war from your portal and create a custom project on NWDS. It will also create ear file in NWDS.

3)       Rename the project as contentarea.war

4)       In this war file there will be a jar  file “com.sap.portal.navigation.contentarea_core.jar At this path ” contentarea\WebContent\WEB-INF\private\lib

5)       Unjar this file from command prompt ( Start-Run-CMD) . Go toi the directory where this jar file exists and give command jar –xvf com.sap.portal.navigation.contentarea_core.jar

6)       Two folders will be created COM and meta-inf . we need to change the code in this class file :

\WebContent\WEB-INF\private\lib\com\sapportals\portal\navigation\workAreaIview.class

7)       Download the JDdecompiler from internet site to get the source code for this class file.

😎       Once you get java file: add the PIWIK code to this file and recompile the file.

9)       Now replace the new class file in folder \WebContent\WEB-INF\private\lib\com\sapportals\portal\navigation

10)   Create a zip file in path \WebContent\WEB-INF\private\lib\. This zip file should have com and Meta-inf folder . Rename this zip file to com.sap.portal.navigation.contentarea_core.jar 

11)   Deploy the war file and ear file on server.

12)   Now create a contentArea iView from the contentarea.war default component.

13)   Go to content admin -> your framework page and open properties. Modify the property URL for contentarea to point to your new Contentarea iView. And save the page

14)   Now when you navigate on any portal page, the hits will be captured by PIWIK code.

PIWIK Output

     Once PIWIK is configured to run on SAP Enterprise portal, all the user hits will be captured by PIWIK server. Below are some of the graphs we can get :

Conclusion :

Thus we can configure our Portal to track Portal hits and get the usage statistics .

3 Comments
Labels in this area