Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Collecting data from your application

The metrics and reports that you view in the Analytics Service web portal are populated by parameters that your application sends to the data collection server. Your application sends most of the parameters to the data collection server automatically when an event occurs. Depending on the type of event, there are some parameters that you can specify values for (for example, if your application tracks ad clicks, you must specify the name of the ad as a parameter). You don't need to be familiar with all the parameters to use the Analytics Service, but understanding which parameters are associated with each event can help you understand how metrics and reports are generated in the web portal.

Loading configuration data

To permit your application to communicate with the data collection server, you must provide it with configuration data. The configuration data contains information, such as your developer dcsid, which tells the data collection server that the data it receives should be associated with your Analytics Service web portal account. You can use WebtrendsConfigurator.LoadConfigFile() to do this.

You must pass one of three things into LoadConfigFile(): a config.xml file that is located in the same package as your application, the WebtrendsConfig abstract class, or an implementation of the IWebtrendsConfig interface.

Firstly, you can use WebtrendsConfigurator.LoadConfigFile(String packageName, String filename) to load the XML configuration file provided with the Analytics Service SDK. Your config.xml file must be located in the same package as the class in which you call this method.

To successfully import the configuration file using the code sample below, the file must be located in the com.sample package, along with AnalyticsDemo.java.

Code sample: Importing an external .xml file
WebtrendsConfigurator.LoadConfigFile("com.sample.AnalyticsDemo", "config.xml");

If you don't want to rely on an external .xml file, you can provide WebtrendsConfigurator.LoadConfigFile() with an instance of the WebtrendsConfig abstract class. The methods provided by WebtrendsConfig return the same default values as the .xml file. You can overwrite these methods as needed to provide your own configuration settings.

Code sample: Using the WebtrendsConfig abstract class
 WebtrendsConfigurator.LoadConfigFile(
             new WebtrendsConfig()
             {
                   public String wt_dc_app_name() {
                         return "TheBestHelloWorldAppEver";
                   }
                   public String wt_dc_app_version() {
                         return "1.0.22";
                   }
                   public String wt_dc_dcsid() {
                         return "dcs123456789012owzt929yog_1234";   
                   }
                   public String wt_dc_debug() {
                         return "false";
                   }
                   public String wt_dc_timezone() {
                         return "-8";
                   }
                   public String wt_dc_url() {
                         return "http://dc.webtrends.com/v1";
                   }
                   public String wt_dc_app_category(){
                         return "Games";
                   }
                   public String wt_dc_app_publisher(){
                         return "WTEng-Test-App";
                  }
            }
        );

You can also pass in an implementation of the IWebtrendsConfig interface. The IWebtrendsConfig interface defines methods for all the tags in the provided .xml file, but provides no defaults. It is recommended that you use the WebtrendsConfig class, which provides defaults, for this reason.

Code sample: Using the IWebtrendsConfig interface
WebtrendsConfigurator.LoadConfigFile(
     new IWebtrendsConfig()
     {
		  // provide implementation
     }
);
 

Tracking starts, exits, and transitions between states

You can view reports that describe high-level user behavior, such as session lengths and screen views per session. To view these types of reports, your application must track each time a BlackBerry device user starts or exits a session, or moves your application to the background or foreground.

To enable your application to track starts and transitions between states, you application must extend either the WebtrendsApplication class or the WebtrendsUiApplication class. To enable your application to track exits, you must override onClose() and invoke onApplicationTerminate().

The following code sample demonstrates how you can create a framework for an application that tracks starts, exits and transitions between states:

public class AnalyticsDemo extends WebtrendsUiApplication
{
    public static void main(String[] args)
    {
        AnalyticsDemo theApp = new AnalyticsDemo();
        theApp.enterEventDispatcher();
    }

    public AnalyticsDemo()
    {
        pushScreen(new AnalyticsDemoScreen());
    }

    public class AnalyticsDemoScreen extends MainScreen implements FieldChangeListener
    {
        public AnalyticsDemoScreen()
        {
            //Code contained in the constructor.
        }
      
        public boolean onClose()
        {
            try 
            {
                WebtrendsDataCollector.getInstance()
                    .onApplicationTerminate( "Application Terminate", null );
            } 
            catch (IllegalWebtrendsParameterValueException err) 
            {
                WebtrendsDataCollector.getLog().e(err.getMessage());
            }
            System.exit(0);
            return true;
        }
    }
}

To see how this code sample works in an application that you can compile, see the full code sample.

Tracking specific events

You can view reports that describe specific actions and events that occur in your application, such as button clicks, ad views, and errors. To track these types of events, you must invoke one of the following methods for each individual event when it occurs in your application.

Event

Method

Ad click

onAdClickEvent()

Ad impression

onAdImpressionEvent()

Application error

onApplicationError()

Button click

onButtonClick()

Screen view

onScreenView()

Conversion event

onConversionEvent()

Custom event

onCustomEvent()

Media event

onMediaEvent()

Product view

onProductView()

Search event

onSearchEvent()

Method: onAdClickEvent()

The onAdClickEvent() method collects information about individual ad click events and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about ad click events in the following reports:

  • In-App Ads
  • Events: App
  • Events

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onAdClickEvent(String eventPath, String eventDesc, String eventType, Hashtable customData, String adName)

Data collection parameters

When you invoke onAdClickEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

Specifies a Hashtable object that contains custom data. This method does not support sending custom data

WT.a_an

adName

Specifies the name of the ad

WT.a_ac

1

Indicates that an ad click occurred

WT.sys

"adclick"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking an ad click event

try
{
    WebtrendsDataCollector.getInstance().onAdClickEvent("/mainscreen/classifieds", 
        "Classifieds screen", "click", null, "car ad");
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onAdImpressionEvent()

The onAdImpressionEvent() method collects information about ad impressions and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about ad impression events in the following reports:

  • In-App Ads
  • Events: App
  • Events

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onAdImpressionEvent(String eventPath, String eventDesc, String eventType, Hashtable customData, String[] adNames)

Data collection parameters

When you invoke onAdImpressionEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

Specifies a Hashtable object that contains custom data. This method does not support sending custom data

WT.a_an

adNames[]

Specifies an array of ad names

WT.a_ai

1

Indicates that an ad impression occurred

WT.sys

"adimpression"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking an ad impression event

String[] adNames = {"sports ad1", sports ad2", "sports ad3"};
try
{
    WebtrendsDataCollector.getInstance()
        .onAdImpressionEvent("/newsapp/topstories", "Headline screen", "ad view", null, adNames);
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onApplicationError()

The onApplicationError() method collects information about application errors and sends the information to the data collection server. To use this method, you must pass in the message that is associated with the error using a Hashtable object.

On the Analytics Service web portal, you can view data about errors in the following reports:

  • Events: App
  • Errors
  • Key Metrics

For a complete list of reports, and to see how parameters contribute to each report, see Reports and parameters.

Syntax

public void onApplicationError(String applicationName, Hashtable customData)

Arguments

Argument

Description

applicationName

Specifies the name of the application and sends the name of the application to the data collection server using the dcsuri parameter

customData

This parameter specifies a Hashtable object that contains custom data. This method requires that you pass in the WT.er parameter. You must set the value of WT.er to the status message of the exception that your application throws.

"error"

Specifies the type of system event and sends the name of the application to the data collection server using the WT.sys parameter

For a list and descriptions of the parameters common to every event, see Common parameters.

Code sample: Tracking an application error event

try
{
    // code that the application is attempting to run
}
catch (Exception e)
{
    Hashtable customParams = new Hashtable();
    customParams.put("WT.er", e.getMessage());    
 
    try
    {
        WebtrendsDataCollector.getInstance()
            .onApplicationError("Analytics Demo", customParams);
    }
    catch (IllegalWebtrendsParameterValueException err)
    {
        WebtrendsDataCollector.getLog().e(err.getMessage());
    }
}

Method: onButtonClick()

The onButtonClick() method collects information about button clicks and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about button click events in the following reports:

  • Events: App
  • Events

For a complete list and descriptions of reports, see Reports and parameters.

Synatx

public void onButtonClick(String eventPath, String eventDesc, String eventType, Hashtable customData)

Data collection parameters

When you invoke onButtonClick(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

Specifies a Hashtable object that contains custom data. Sending custom data is not supported by this method

WT.sys

"click"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a button click event

try
{
    WebtrendsDataCollector.getInstance()
        .onButtonClick("/chatapp/newuser", "Signup screen", "sign up", null);
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onScreenView()

The onScreenView() method collects information about content view events and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about content view events in the following reports:

  • Events: App
  • Events
  • Media: Titles
  • Media: Types
  • Key Metrics

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onScreenView(String eventPath, String eventDesc, String eventType, Hashtable customData, String contentGroup)

Data collection parameters

When you invoke onScreenViewEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where a screen is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

Specifies a Hashtable object that contains custom data. This method does not support sending custom data

WT.cg_n

contentGroup

Specifies a category name for the content (for example, "sports" or "music")

WT.sys

"screen"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a screen view event

try
{
    WebtrendsDataCollector.getInstance()
        .onScreenView("/eBooksApp/newbook/details", "Book viewer screen", "book view", null, "fiction");
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onConversionEvent()

The onConversionEvent() method collects information about conversion events and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about conversion events in the following reports:

  • Events: Conversion
  • Events: App
  • Events
  • Key Metrics

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onConversionEvent(String eventPath, String eventDesc, String eventType, Hashtable customData, String contentGroup, String conversionName)

Data collection parameters

When you invoke onConversionEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

Specifies a Hashtable object that contains custom data. This method does not support sending custom data

WT.cg_n

contentGroup

Specifies a category name for the content (for example, "sports" or "music")

WT.conv

conversionName

Specifies a name for the conversion type

WT.si_cs

1

Indicates that the conversion step is successful

WT.sys

"conversion"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a conversion event

try
{
    WebtrendsDataCollector.getInstance()
        .onConversionEvent("/musicapp/preview", "Upgrade version screen", "upgrade", null, "music", "full version");
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onCustomEvent()

The onCustomEvent() method collects information about custom events and sends the information to the data collection server.

In the web portal for the Analytics Service, you can view data about custom events in the following reports:

  • Events: App
  • Events

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onCustomEvent(String eventPath, String eventDesc, Hashtable customData)

Data collection parameters

When you invoke onCustomEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

customData

This parameter specifies a Hashtable object that contains custom data. This method requires that you pass in the WT.ev parameter. You must set the value of WT.ev to the type of event that occurs (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom").

WT.sys

"custom"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a custom event

Hashtable customParams = new Hashtable();
customParams.put("WT.ev", "Level cleared");

try
{
    WebtrendsDataCollector.getInstance()
        .onCustomEvent("ActionGame/main", "Level 3", customParams);
}
catch (IllegalWebtrendsParameterValueException e)
{
    WebtrendsDataCollector.getLog().e(e.getMessage());
}

Method: onMediaEvent()

The onMediaEvent() method collects information about media events and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about media events in the following reports:

  • Media: Titles
  • Media: Types
  • Events: App
  • Events

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onMediaEvent(String eventPath, String eventDescr, String eventType, Hashtable customData, String contentGroup, String mediaName, String mediaType, String mediaEventType)

Data collection parameters

When you invoke onMediaEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

This parameter specifies a Hashtable object that contains custom data. This method does not support sending custom data.

WT.cg_n

contentGroup

Specifies a category name for the content (for example, "sports" or "music")

WT.clip_n

mediaName

Specifies the name of the piece of media

WT.clip_t

mediaType

Specifies the type of media (for example, "music" or "video")

WT.clip_ev

mediaEventType

Specifies the status of the media event. Acceptable values are "p" (played), "25" (25% completed), "50" (50% completed), "75" (75% completed, and "f" (finished)

WT.sys

"media"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a media event

try
{
    WebtrendsDataCollector.getInstance()
        .onMediaEvent("/MyMusic/catalog", "Media player screen", "play song", null, "Music", "mp3", "75");
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onProductView()

The onProductView() method collects information about individual product view events and sends the information to the data collection server.

In the web portal for the Analytics Service, you can view data about product view events in the following reports:

  • Products
  • Product: Types
  • Events: App
  • Events
  • Categories
  • Key Metrics

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onProductView(String eventPath, String eventDesc, String eventType, Hashtable customData, String contentGroup, String productId, String productSku)

Data collection parameters

When you invoke onProductView(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

WT.tx_e, WT.tx_u

customData

This parameter specifies a Hashtable object that contains custom data. This method requires that you pass in the WT.tx_e and WT.tx_u parameters. You must set the value of WT.tx_e to "v", and the value of WT.tx_u to the number of product views.

WT.cg_n

contentGroup

Specifies a category name for the content (for example, "sports" or "music")

WT.pn_id

productId

Specifies the ID for the product (optional)

WT.pn_sku

productSku

Specifies the SKU for the product

WT.sys

"product"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a product view event

Hashtable customParams = new Hashtable();
customParams.put("WT.tx_e", "v");
customParams.put("WT.tx_u", "4");

try
{
    WebtrendsDataCollector.getInstance()
        .onProductView("/eBooksApp/newbook/details", "Details Screen", "eBook view", customParams, "Sports", "12345", "abc123");
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Method: onSearchEvent()

The onSearchEvent() method collects information about user searches and sends the information to the data collection server. This method does not support the customData argument, so you must pass in null as the value when you invoke the method.

In the web portal for the Analytics Service, you can view data about search events in the following reports:

  • In-App Searches
  • Events: App
  • Events

For a complete list and descriptions of reports, see Reports and parameters.

Syntax

public void onSearchEvent(String eventPath, String eventDesc, String eventType, Hashtable customData, String searchPhrase, String searchResult)

Data collection parameters

When you invoke onSearchEvent(), the following parameters are sent to the data collection server to populate reports.

Parameter

Value

Description

dcsuri

eventPath

Specifies the hierarchical location of where an object or content is located in an application (for example, "mainscreen/optionscreen/samplemedia")

WT.ti, WT.pi

eventDesc

Specifies the name of the screen where the event occurs

WT.ev

eventType

Specifies the event type (for example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom")

null

customData

Specifies a Hashtable object that contains custom data. This method does not support sending custom data

WT.oss

searchPhrase

Specifies a search phrase used in the application

WT.oss_r

searchResult

Specifies a String that contains an integer that represents the number of search results returned

WT.sys

"search"

Specifies the type of system event

For a list of parameters common to all events, see the parameter reference.

Code sample: Tracking a search event

try
{
    WebtrendsDataCollector.getInstance()
        .onSearchEvent("/GPSapp/newlocation", "Navigation screen", "search", null, "Waterloo", "1");
}
catch (IllegalWebtrendsParameterValueException err)
{
    WebtrendsDataCollector.getLog().e(err.getMessage());
}

Types of reports

An matrix of the different types of reports available for each method.
Report Description

Key Metrics

This report displays the number of screen views, active sessions, product views, outbound links, conversions, application starts, application terminations, application errors, and daily, weekly, monthly, quarterly, and yearly users for the application for a specific time interval.

Events: App

This report displays the number of times system events occur within an application, how many screen views that session contained, and the percentage of sessions in which that event occurs. There are eight system events: "error", "startup", "exit", "conversion", "pause", "end", "resume", and "view."

App Versions

This report displays the number of sessions and screen views per version of the application. The version number of an application is specified during the development process.

Carriers

This report displays the number of sessions and screen views per wireless service provider.

Geo: Countries

This report displays the number of sessions and screen views per country.

Devices

This report displays the number of sessions and screen views per BlackBerry device model.

OS

This report displays the number of sessions and screen views per device operating system.

Geo: Languages

This report displays the number of sessions and page views per language.

Geo: Countries + Languages

This report displays the number of sessions, in a particular language, per country.

Sessions: Duration

This report displays the number of sessions per session duration.

Sessions: Frequency

This report displays the number of users who participate in a certain number of sessions. For example, the report can list the number of users that participate in 1, 5, or 10 sessions.

Categories

This report displays the number of sessions, screen views, total view time and average time views per application category. For example, "sports", "weather", or "news".

Categories: Screens

This report groups top screen data into categories when the contentGroup parameter is included with the onScreenView method or onContentView method.

Errors

This report displays where in the application the error occurs, and what exception is thrown by the application.

You can view this report if you design your application to track errors.

Events

This report displays the number of times an event occurs within the application.

For example, you can track general events such as "click" or "view", or you can track more specific events such as "horizontal swipe" or "zoom". You can view this report if you design your application to track different events.

Events: Conversions

This report displays, for each named conversion event, how many sessions contained that conversion event, and how many conversions occurred within those session.

A conversion event is an event determined by you in which a user takes a desired action within the application. For example, a conversion event could be a user upgrading to a paid version of your application, buying a song, or clicking an ad.

You can view this report if you design your application to track conversion events.

In-App: Ads

This report displays ad views and ad clicks per advertisement name.

You can view this report if you design your application to track ad clicks.

In-App: Searches

This report displays the number of times a phrase is searched for in the application.

You can view this report if you design your application to track search terms.

Media: Titles

This report displays the number of media plays per session by media title.

You can view this report if you design your application to track media plays.

Media: Types

This report displays the number of media plays per session by media type.

You can view this report if you design your application to track media plays.

Users: New + Returning

This report compares the number of screen views, product views, outbound links, conversions, application starts, application exits, application errors, as well as daily, weekly, monthly, quarterly and yearly users for new users versus returning users.

Outbound Links

This report displays the number of clicks on external links per session. It can be viewed if your application is designed to track Outbound links.

Products

This report displays the number of sessions in which a particular product was viewed.

An example of a product is a digital good, or any other product that your application offers. You can view this report if you design your application to track product views.

Products: Type

This report displays the number of sessions in which a particular product type was viewed.

You can view this report if you design your application to track product views.

Screens

This report displays the number of sessions, views, average time viewed, single screen view visits, entry screen view visits, and the bounce rate for all screens within an application.

Screens: Exits

This report displays the number of exits per screen name.

Common parameters

When any event occurs that your application is tracking, the application sends the following parameters to the data collection server. In addition to these parameters, which are common to every event, each event has its own unique set of parameters.

Parameter

Description

WT.av

Specifies the application version

WT.dm

Specifies the BlackBerry device model

WT.os

Specifies the version of the BlackBerry Device Software

WT.co_f

Specifies the unique ID for the current user

WT.vtvs

Specifies the time in milliseconds according to Posix time

WT.tz

Specifies the time zone where the user is currently located

WT.vtid

Specifies the unique ID for the current session

WT.ets

Specifies the time according to standard time

WT.a_nm

Specifies the application name

WT.a_cat

Specifies the application category

WT.a_pub

Specifies the application publisher

WT.g_co

Specifies the user's country

WT.ul

Specifies the user's language

Code sample: Collecting data from your application

import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.*;
import com.webtrends.mobile.rim.*;
import com.webtrends.mobile.analytics.rim.*;
import com.webtrends.mobile.analytics.*;

public class AnalyticsDemo extends WebtrendsUiApplication
{
    public static void main(String[] args) 
    {
        WebtrendsConfigurator.LoadConfigFile("com.samples.AnalyticsDemo", 
                "webtrends.xml");
        WebtrendsDataCollector wtDC = WebtrendsDataCollector.getInstance();
        wtDC.Initialize();
		      
        AnalyticsDemo theApp = new AnalyticsDemo();
        theApp.enterEventDispatcher();
    }

    public AnalyticsDemo()
    {
        pushScreen(new AnalyticsDemoScreen());
    }

    public class AnalyticsDemoScreen extends MainScreen implements FieldChangeListener
    {
        public AnalyticsDemoScreen()
        {
            setTitle("Analytics Demo");
    		
            ButtonField buttonField = new ButtonField("Close");
            buttonField.setChangeListener(this);
            add(buttonField);		
        }

        public void fieldChanged(Field field, int context)
        {
            try
            {
                WebtrendsDataCollector.getInstance().onButtonClick("/Analytics/Main", 
                        "MainScreen", "click", null);
            } 
            catch (IllegalWebtrendsParameterValueException err)
            {
                WebtrendsDataCollector.getLog().e(err.getMessage());
            }
            onClose();
        }
	
        public boolean onClose()
        {
            try 
            {        
                WebtrendsDataCollector.getInstance().onApplicationTerminate(
                        "SampleApp", null);
            } 
            catch (IllegalWebtrendsParameterValueException err) 
            {    
                WebtrendsDataCollector.getLog().e(err.getMessage());
            }
            System.exit(1);
            return true;
        }
    }
}