Usage Tracking for IBM
®InfoSphere
®Business Glossary
InfoSphere Business Glossary Version 8.7 and later includes a feature that allows you to track usage of InfoSphere Business Glossary through web analytics tools such as IBM NetInsight, Google Analytics or Piwik, in a way that does not interfere with InfoSphere Business Glossary code and that can be maintained from release to release.
The feature tracks web browser page hits on each InfoSphere Business Glossary page. For Version 9.1 and later, the tracking process detects page hits for both InfoSphere Business Glossary Anywhere and InfoSphere Business Glossary when accessed from a web browser. Releases prior to 9.1 detect page hits only when InfoSphere Business Glossary is accessed from a web browser.
To implement this feature, you add code that is specific to the tool that you are using to a file that is provided with InfoSphere Business glossary, and in WebSphere Administration Server you configure a system property to point to the file.
This document explains how to configure the tracking feature, and uses as its example the open source tool Piwik. Piwik is available at http://www.piwik.org.
In this step-by-step example, we show you how to modify the provided file, configure WebSphere Application Server, and then provide a sample of the results.
1. Installing Piwik and its prerequisites
Installing prerequisites
To run Piwik, which we use as our example, you must also have the following prerequisites:
• Web server • PHP • MySQL
Refer to the Piwik web site at www.piwik.org for the specific versions of these
prerequisites that are required and other recommendations. For our example, we use the open source package WampServer to provide these prerequisites. To install the
WampServer package:
1. From the computer that you want to host your web server on, navigate to www.wampserver.com.
2. Download and install a version of WampServer that corresponds to your computer (32-bit or 64-bit). During installation, click Next at every prompt to use the defaults. (Note: You might want to change the email address.)
The directory in which you install should look like this:
3. Make sure that WampServer is running and online before you move to the next step (Installing Piwik). The WampServer icon is displayed in your system tray. If WampServer is running, the icon should be green. To further verify that WampServer is running or to access the stop and start menu, left-click on the WampServer icon.
Installing Piwik
1. Point your web browser to www.piwik.org.
2. Download and install Piwik using the directions provided at the Piwik web site. 3. Copy the installed piwik directory to the www directory of the Apache server. For
WampServer to C:/wamp, then copy the contents of the
C:/piwik_install/piwik directory to the directory C:/wamp/www. 4. Follow the prompts for the Piwik installation. Use the following values:
• login: root
• password: none — leave this field empty • database name: piwik
• super user credentials: This creates a super-user account for Piwik.
Recommended: This user should have administrative privileges on the system that hosts Piwik.
• Web site: Configure the web site in the format host_name:port/bg. For example:
9.147.56.248:9080/bg
5. At the end of the Piwik installation process, a window opens that contains the code that you must add to the business glossary tracking file. Retain a copy of this code. You will place it in the required location in a later step. Here is the code for Piwik 1.9.2:
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik_URL" : "http://piwik_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", 1); piwikTracker.trackPageView();
piwikTracker.enableLinkTracking(); } catch( err ) { }
</script><noscript><p><img src="http://piwik_URL/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
where
piwik_URL is the URL to the Piwik directory on the server that hosts Piwik. For example:
9.148.56.248/piwik/
and where
n is the Id number of the web site as assigned by Piwik. If this is the only web site you are tracking with Piwik, n=1. If you have other web sites being
tracked by the same instance of Piwik, the value of n could be another number.
Piwik automatically inserts the correct values for piwik_URL and n in the code that it provides at the end of the installation process.
2. Editing the tracking file
1. Locate the file bg_tracking.html, which is located in the following directory on the WebSphere Application Server host computer:
IBM\WebSphere\AppServer\profiles\InfoSphere\installedApps\BG-DevNode01Cell\GlossaryBrowser.ear.ear\BGNGWeb.war
2. Copy the file bg_tracking.html to a directory that is outside of the WebSphere
Application Server installation directory. This is so that if InfoSphere
Information Server or WebSphere Application Server is updated or reinstalled, the file will not be overwritten.
3. Paste the code for your web tracking tool (in this case, Piwik) in the
bg_tracking.html file where indicated. Here are the contents of the original
bg_tracking.html file: <!--
Place optional JavaScript usage tracking code here or in file defined by system property 'bg.tracking.include'
All code must be placed within <script> tags -->
<script>
function bgTrackPageEvent(url, pageTitle, fullTitle) { //place custom tracking code here
}
</script>
4. Add the callbacks to the tracking tool after the bgTrackPageEvent function. For Piwik, for example:
{
piwikTracker.setDocumentTitle(pageTitle); piwikTracker.trackPageView();
}
Here is a sample bg_tracking.html file that has been modified by the addition of the tracking code:
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://9.148.56.248/piwik/" : "http://9.148.56.248/piwik/");
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", 1); piwikTracker.trackPageView();
piwikTracker.enableLinkTracking(); } catch( err ) {}
</script><noscript><p><img
src="http://9.148.56.248/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code --> <script type="text/javascript">
function bgTrackPageEvent(url, pageTitle, fullTitle) { piwikTracker.setDocumentTitle(pageTitle);
piwikTracker.trackPageView(); }
</script>
3. Configuring WebSphere Application Server
1. Log in to the WebSphere Application Server Integrated Solutions Console. 2. Select Servers > Server types > WebSphere application servers > server1.
3. Under Server Infrastructure, select Java and Process Management > Process definition.
4. Under Additional Properties, select Java Virtual Machine. 5. Under Additional Properties, select Custom properties. 6. Click New.
7. Enter the Name, Value, and optional Description of the tracking system property where
Name is bg.tracking.include
For example:
8. Click Apply.
9. Click Save at the top of the window to save the changes to the WebSphere Application Server master configuration.
Results
Here is an example of the results returned by Piwik. You can customize the “dashboard” of results.
The instructions in this document apply to Piwik 1.9.2 and WampServer 2.2E. Installation instructions for other versions of these tools might differ from what is described in this document. Refer to the web sites www.piwik.org and
www.wampserver.com for current installation instructions and support for Piwik and WampServer, respectively.
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of
International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml.