This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

You can configure the APP Manager to track web application invocation statistics through Google Analytics. Google Analytics is a service that allows you to track visits to a website and generate detailed statistics on them.

This guide explains how to set up App Manager to feed runtime statistics to Google analytics for summarization and display.

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

  2. Open $APPM_HOME/repository/conf/api-manager.xml. Enable the <GoogleAnalyticsTracking> element and enter the Tracking-ID.

     

    <GoogleAnalyticsTracking>
       <!-- Enable/Disable Google Analytics Tracking -->
       <Enabled>false</Enabled>
       <!-- Google Analytics Tracking ID -->
       <TrackingID>UA-XXXXXXXX-X</TrackingID>
    </GoogleAnalyticsTracking>
  3. Save the file and restart the APP Manager instance.

  4. Once we have the APP Manager setup to integrate with your Google Analaytics account, we have to place the following JavaScript snippet onto the pages we wish to track.

    <script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" 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: {            
                "trackingCode":tracking_code,        
                }              
            }
        );    
    }
    </script>

The above script should include your applications tracking code (this is generated when you publish an application) with the request URL pointing to your APP Manager gateway.

When the pages that have included the snippet above are invoked, the APP Manager will publish statistics to the enabled anlaytics engines (BAM / Google Analytics or both).

Real-time statistics

Following image shows an invocation of a specific web application. The Google Analytics graphs and statistics will be displayed at run time in its Real Time view. This example displays the PageViews per second graph and 1 user as active.

 

Reporting statistics

Google Analytics reporting statistics take more than 24 hours from the time of invocation to populate. Shown below is a sample Dashboard with populated statistics.

 

Cookies

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


  • No labels