Versions Compared

Key

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

Google Analytics is a service that allows you to track visits to a website and generate detailed statistics on them. You can configure App Manager to track web application invocation statistics through Google Analytics .  This guide explains how to set up App Manager to feed runtime statistics to Google analytics for summarization and display.

Table of Contents

  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_HOME>/repository/conf/api-manager.xml file, add the <GoogleAnalyticsTracking> element and enter the tracking ID as follows.

     

    Code Block
    <GoogleAnalyticsTracking>
       <!-- Enable/Disable Google Analytics Tracking -->
       <Enabled>false</Enabled>
       <!-- Google Analytics Tracking ID -->
       <TrackingID>UA-XXXXXXXX-X</TrackingID>
    </GoogleAnalyticsTracking>
  3. Save the <PRODUCT_HOME>/repository/conf/api-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 track.

    Code Block
    <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>
    Info

    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 App Manager gateway. When the pages that includes the above snippet are invoked, App Manager will publish statistics to the enabled anlaytics engines (BAM / Google Analytics or both).

...