Last updated May 02, 2013 11:45, by Ernandes Mourao Jr
Feedicon  

Google Analytics ME Wiki (Support us!)

Google Analytics ME is a compelling and well defined API for Java ME developers who wish to integrate their apps into Google Analytics. With this API, developers will be able to prepare their apps to send out useful data, about how users are interacting with them. Those data will be valuable to identify, e.g., audience and improvement points.

Table of Contents:

  1. Licensing
  2. Minimum Requirements
  3. Update History
  4. Sample Codes
  5. Donation
  6. See Also
  7. References
  8. External Links

Licensing

Google Analytics ME is under two licenses: GNU General Public License v2.0 regarding the source code and GNU Lesser General Public License v3.0 for the binaries. It means that now you can develop proprietary applications with Google Analytics ME' if you merely link them to API's binaries.

(back to top)

Minimum Requirements

  • Java Micro Edition (MIDP 2.0 / CLDC 1.0) or newer
  • Internet connection (e.g. GPRS, EDGE, 3G, wi-fi, etc)
  • Google Analytics account*

*By creating an account on Google Analytics, make sure you select "Web Site", when asked what you would like to track. "App" will not work for this API.

(back to top)

Update History

Google Analytics ME is now at its fifth release (2.1). This last version consists of bug fixes and new features.

Version Date Contents
2.1
06/07/2012
  • Fixed issue that was not identifing properly unique visitors.
  • Improved session counter and visit duration calculation.
  • Assign a custom user agent throught the JAD property "GAME-Custom-UserAgent".
2.0
01/02/2012
  • Identification of unique and returning visitors.
  • Better visitor's features identification.
  • Small code refactoring.
  • Android support deprecated.
1.2
03/11/2011
  • Android support
1.1
01/13/2011
  • A bug fix related to visitor identification.
1.0
12/27/2010
  • Page View and Event tracking
  • Synchronous and Asynchronous communication

(back to top)

Sample Codes

In order to help you to quick learn how to work with Google Analytics ME, here it goes some sample codes showing how to perform some common tasks.

- Tracking how many times a MIDlet is started up:

public class MediaPlayerMIDlet extends MIDlet {

  public AppMIDlet() {
    ...
    Tracker tracker = Tracker.getInstance(this, "UA-1736743-0");
    tracker.addToQueue(new PageView("/midlet_started"));
    ...
  }
  ...
}

- Tracking how many times a screen is displayed:

public class MediaPlayerScreen extends Form {
  ...
  public void commandAction(Command c, Displayable d) {
    if (c == cmdSongDetail) {
      Tracker tracker = Tracker.getInstance(midlet, "UA-1736743-0");
      tracker.addToQueue(new PageView("/song_detail"));
      //
      display.setCurrent(detailScreen);
    }
    ...
  }
  ...
}

- Tracking how many times a function of a screen is performed:

...
public void play() {
  Tracker tracker = Tracker.getInstance(midlet, "UA-1736743-0");
  tracker.addToQueue(new Event("/media_player", "Play", null, null));
  ...
}
...

- Tracking events synchronously:

...
public void rewind() {
  Tracker tracker = Tracker.getInstance(midlet, "UA-1736743-0");
  tracker.track(new Event("/media_player", "Rewind", null, null));
  ...
}
...

- Explicitly *flushing all queued events:

public class MediaPlayerMIDlet extends MIDlet {
  ...
  public void destroyApp(boolean unconditional) {
    Tracker tracker = Tracker.getInstance(this, "UA-1736743-0");
    tracker.flush(false);
  }
}

*Make to sure to call this method (synchronously) before the app is destroyed. Otherwise, any queued requests will be lost.

- Customize User Agent in JAD file:


MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-2.0
...
GAME-Custom-UserAgent: NokiaN90-1/3.0545.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1
...

(back to top)

In case of Google Analytics ME has brought good benefits for you and/or your company, and because of that you would like to thank us for all our hard work. Please, feel free to donate us any amount, via PayPal, by clicking here. It is easy and quick to do. In addition, this contribution will provide us more resources to keep up improving this API for you.

(back to top)

See Also

References

External Links

  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2014, Oracle Corporation and/or its affiliates
(revision 20160708.bf2ac18)
 
 
Close
loading
Please Confirm
Close