Traditionally, the Portal Activity Report has been the default method for gather information on how users use the Netweaver Portal. The Portal Activity Report enabled a portal administrator to gather information about users who logged into the portal and what content they used.

The Portal Activity Report displays the following information

  • Number of users who have logged on during a specific timeframe
  • Information on those users who have logged on
  • The portal content (iviews and pages ) and KM content ( documents ) which users have viewed

The information provided by the Portal Activity Report is very useful to get a general understand on how the portal is being used. However, it is severly lacking in information when compared to other web traffic reporting tools (i.e. WebTrends, Google Analytics, or Omniture ).

Some of the major discrepancies include:

  • Traffic Pattern/Path Information – How did users travel through the portal?
  • Geographic Information – Where did users access the portal from?
  • User Technical Information – What browsers are users using? What is their connection speed? What is their screen resolution?

This article will highlight some recent efforts to integrate one of these best-of-breed web traffic tools, Google Analytics, with the Netweaver Portal. Integration of the two applications will provide both portal administrators and business users imperative information on how their users conduct business within their Netweaver landscape.

Google Analytics is a robust web analysis system that provides traffic metrics and massive amounts of useful user-traffic data. Analytics features an elegant user interface that leverages modern web technologies like Flash and DHTML. It can also export data in several formats, including XML and CSV and email reports on

Google Analytics

Google Analytics

With Analytics, you can determine where your visitors are coming from, which links on your site are getting the most hits and how long the visitors spend on various pages of your site. In addition to providing critical marketing data, it also tracks browser features so that you can make informed design decisions. Analytics will tell you the screen resolution and connection speed of your users.

Integration Instructions

Google Analytics Account Setup

The setup the Google Analytics account is basic and free. It is recommended that you setup for two accounts; one for production user and one to use as a base for testing.

Step 1 – Establish an account with Google Analytics

  • Go to http://www.google.com/analytics
  • Enter your Google account email and password and click Sign In
  • Enter your portal’s URL, making sure to select either http:// or https:// from the drop-down list.
  • Do not worry if your portal is not accessible from the Internet, this is only used for tracking purposes
  • Enter your contact information
  • Read and agree to the Google Analytics Terms of Service

Step 2 – Get the Google Analytics tracking code

Google Analytics only tracks pages that contain the Google Analytics tracking code. The first step is to get the specific tracking code for your site. The second step ( which will be covered later ) is to add the code to each of your portal pages which you want to track.

  • Sign into Google Analytics
  • From the Analytics Settings page, select the site ( Production or Development ) which you would like to view  the tracking code.
  • From that profile’s Settings column, click Edit.
  • At the top right of the Main Website Profile Information box, click Check Status.
  • The tracking code can be copied and pasted from the text box in the Instructions for adding tracking section.

Sample Tracking Code:

<script type=”text/javascript”>
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script type=”text/javascript”>
var pageTracker = _gat._getTracker(”UA-xxxxxx-x”);
pageTracker._initData();
pageTracker._trackPageview();
</script>

You’ll need to update the “xxxx-x” in the sample above with your own Google Analytics account number.

Step 3 – Get your Google Analytics account number

  • Sign in to Google Analytics
  • From the Analytics Settings page, find the site for which you would like to retrieve the tracking code.
  • From that profile’s Settings column, click Edit.
  • At the top right of the Main Website Profile Information box, click Check Status.
  • Your tracking code can be copied and pasted from the text box in the Instructions for adding tracking section

SAP Netweaver Portal Integration

The integration with the Netweaver Portal is also basic and straightforward. The following instructions will guide you through the process and it is recommended that an experienced portal administrator make the changes required.

Step 1 – Create a portal application which displays the Google JavaScript code

  • Create a standard PAR project within the Netweaver Developer’s Studio
  • Develop code to display the required JavaScript

Sample Java servlet Code:

response.write(”<script type=\”text/javascript\”>\n”);
response.write(”var gaJsHost = ((\”https:\” == document.location.protocol) ? \”https://ssl.\” :
\”http://www.\”);\n”);
response.write(”document.write(unescape(\”%3Cscript src=’\” + gaJsHost + \”google-
analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E\”));\n”);
response.write(”</script>\n”);
response.write(”<script type=\”text/javascript\”>\n”);
response.write(”var pageTracker = _gat._getTracker(\”UA-xxxxxx-x \”);\n”);
response.write(”pageTracker._initData();\n”);
response.write(”pageTracker._trackPageview(\”"+ pageNamePrefix + pageName+”\”);\n”);
  • Replace UA-XXXXX-X with your own Google Analytics Account Number
  • Deploy PAR file into the Netweaver Portal

Step 2 – Create Tracker iView from PAR file

The Google Analytics can only be used to track traffic to individual portal pages. The creation of a separate iView will allow each page ( or a subset ) of pages to be tracked.

  • Logon to the Netweaver Portal with a user who has Content Administrator access
  • Create an iView from the PAR file that was deployed

Step 3 – Attach Google Tracker iView to individual pages

  • Logon to the Netweaver Portal with a user who has Content Administrator access
  • Edit a page that you would like tracked
  • Add the Google Tracker iView to the page
  • When ever a user views the page, the Google Analytics code will be executed and will be tracked by the Analytics system
SAP Portal iView Setup

SAP Portal iView Setup

Summary

This article detailed learnings of some recent efforts to integrate one of these best-of-breed web traffic tools and the Netweaver Portal. Integration of the two applications will provide both portal administrators and business users imperative information on how their users conduct business within their Netweaver landscape.

The integration methodology described in this article is meant to only be an introduction. Many more enhancement possibilities exist including:

  • Providing more user-friendly page names within the Analytics reports
  • Tracking of user searches within TREX
  • Integration with other web statistics applications ( WebTrends and Omniture )
  • Providing business users with Cost-Benefit analytics of traffic within the portal
Bookmark and Share

Related Items

3 Responses to “Google Analytics and SAP Netweaver Integration”

  1. Nirmal Says:

    Hi,
    Nice article. But this may not be suitable for Intranet environments where they do not allow internet communications to happen. In most of the cases Intranet users may not have internet link so this may fail.This is suiltable only for external facing applications.

    Regards,
    Nirmal Sivakumar G

  2. cgutjahr Says:

    Hello Nirmal,

    You are correct on some aspects.

    Yes – The client machines which access the portal will need to be able to reach out to the internet for this to work. The code is hosted on the portal, but makes a call to Google to log the information. If your machines cannot go to Google.com via a browser, the solution will not work.

    No – I have used this solution over 10times with portals which are only accessible inside a firewall. The portal can be either internal or external for this solution to work.

  3. Rewrite Articles Says:

    I use Google Analytics for all my sites. It’s amazing how deep you can actually dig into your statistics. The problem is though that lots users just use the basics without realising the flexibility and the raw information you can extract from it.

Leave a Reply