Sample Implementation

The SDK uses a set of JavaScript files that need to be included on your page. We recommend placing the SDK folder in the root folder of your application. You can then include the required files by including the include.js file of the SDK (which in turn includes the JavaScript files automatically).

<script type="text/javascript" src="BangoApplicationAnalyticsSDK/includes.js"></script>

Alternatively, you can manually include all the JavaScript files.

<script type="text/javascript" src="BangoApplicationAnalyticsSDK/md5.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/json2.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoSessionEvents.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoConstants.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoStorage.js"> </script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoEventParameter.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoEvent.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoProfile.js"> </script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoLogger.js"></script>
<script type="text/javascript" src="BangoApplicationAnalyticsSDK/BangoAgent.js"></script>

There are 2 methods that must be called for application analytics to perform correctly. These must be called after any of the configuration options have been set:

Insert a call to BangoAgent.onStartSession(String), passing it your ApplicationId.
We recommend placing this call in the onload method of your page.

index.html
<body onload="init();">
</body>

basic.js
function init()
{
// Configuration Options here

// StartSession here
BangoAgent.onStartSession(ApplicationID);
}

Insert a call to BangoAgent.onEndSession() when a session is complete.
We recommend placing this callbefore closing your application.

function exitApplication()
{
BangoAgent.onEndSession();
window.close();
}

You can then use either the generic method to log an event:
BangoAgent.onEvent(eventName, eventDetail, eventValue, eventParameters)

Alternatively you can use a predefined event method to log a predefined event type:
BangoAgent.onSearch(eventName, eventDetail, eventValue, eventParameters)
BangoAgent.onPageView(eventName, eventDetail, eventValue, eventParameters)

Last edited Apr 13, 2012 at 2:22 PM by bangodev, version 2

Comments

No comments yet.