Our company decided to add Google Analytics to one of our mobile applications. Almost immediately, I found a solution for
J2ME , but I could not find a complete solution for Bada. Since the
Google Analytics API is just HTTP requests with the correct parameters, we only need to implement this under Bada.
So, let's begin:
All we need is to implement two requests: PageView, Event.
For this, I chose the architecture adopted in a similar solution for J2ME
')

The PageView and Event classes inherit from the Request base class and override the url method. An url is formed from a set of parameters that are collected in the TrackingUrl class. Class Tracker is the manager for our requests. From the Tracker class, the PageView and Event requests are launched as they are received - the AddRequestToQueue method. At the same time, the Tracker class can send only one request. Therefore, it is best to create a global variable of type Tracker at the project level.
The sequence of actions to launch a request can be represented in the form of the following scheme:

In the test case, I added 2 buttons to the form that trigger PageView or Event requests, respectively. PageView request is used to enter statistics about the visit pages (forms) in your application. An example of launching a PageView query:
String pageTitle = "Main page";
request = new PageView(pageTitle);
// Send "PageView" request
pTracker->AddRequestToQueue(request);
Where pageTitle is the name or title of your
pages (forms).
Event request is used to enter statistics about the actions of your users in the application. For example, you can keep track of how often a user of your application clicks on a particular button. An example of running an Event request:
String category = "Category";
String action = "Select";
String label = "Event button";
// Send "Event" request
request = new Event(category, action, label, 0);
pTracker->AddRequestToQueue(request);
Where category is the category name, action is the user action (for example: select, clicked, etc.), label is additional data about the user action.
Here you can
download a test project with all source codes. Just remember to add your tracking code!
// TODO : Add your tracking code here
String trackingCode = "Enter your tracking code here!";
pTracker = new Tracker();
I hope that this post will be useful for developers under the mobile platform Bada.
I would welcome comments and additions.