This documentation is for WSO2 App Manager 1.0.0. View documentation for the latest release.
Page Comparison - Integrating with Google Analytics (v.9 vs v.10) - App Manager 1.0.0 - WSO2 Documentation

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. If you are not already subscribed, set up a Google Analytics account and receive a tracking ID in the format of UA-XXXXXXXX-X. A tracking ID is issued at the time an account is created with Google Analytics.

  2. In the <PRODUCT<AppM_HOME>/repository/conf/apiapp-manager.xml file, add the <GoogleAnalyticsTracking> element and set the <Enabled> property to true and, enter the tracking ID as followsobtained from Google Analytics as the value of the <TrackingID> property, within the <GoogleAnalyticsTracking> element as shown below.


    Code Block
       <!-- Enable/Disable Google Analytics Tracking -->
       <!-- Google Analytics Tracking ID -->
  3. Save the <PRODUCT_HOME>/repository/conf/apiapp-manager.xml file, and restart the App Manager instance.

  4. Once App Manager is set up, to integrate it with your Google Analytics account, place the below JavaScript code snippet into the pages that you need to trackto track to integrate it with your Google Analytics account.

    Code Block
    <script language="javascript" src="" type="text/javascript"></script>
    <script language=”javascript”>
        function invokeStatistics(){         
        var tracking_code = ["<AM_TRACKING_CODE>"];         
        var request = $.ajax({        
            url: "http://<AM_GATEWAY_URL>:8280/statistics/",        
            type: "GET",        
            headers: {            

    The above script should include the tracking code of your applications , (which is generated when you publish an application), and the request URL pointing to the App Manager gateway. When the pages that includes include the above snippet are invoked, App Manager will publish statistics to the enabled anlaytics analytics engines (BAM / Google Analytics or both).


Following image shows an invocation of a specific web Web application. The Google Analytics graphs and statistics will be are displayed at runtime in its Real Time view. The below example displays the page views per second graph, and one as he the number of active users.

Reporting statistics


When a single device or client invokes a web Web application via App Manager, each device/client will be is tracked using an anonymous cookie per application. This ensures the fact that successive invocations by a client on the same application, will are not be counted as a new visitor to that application.