Welcome!

Java Authors: Elizabeth White, Pat Romanski, Liz McMillan, Adrian Bridgwater, Sharon Barkai

Related Topics: Java

Java: Blog Feed Post

Google Analytics with Monitis Dashboard

Java is fully supported by Google Analytics libraries

Google Analytics (GA) is a free service provided by Google for collecting statistics about website visitors.

The product is currently in use by around 57% of the 10,000 most popular websites across the globe. GA can track visitors, sessions, traffic sources, goal conversions, page performance metrics and more.

GA is implemented by including what is referred to as the Google Analytics Tracking Code (GATC), and is a snippet of JavaScript code that the user adds onto every page of website. This code collects visitor data and sends it to a Google data collection server.

Monitis’ GA Monitor is a java package that permits the creation of a Monitis custom monitor for viewing Google Analytics on the Monitis Dashboard. This extension of the Monitis API was necessary due to the fact that every website with a lot of traffic uses Google Analytics statistics for analyzing visitor’ traffic — as well as real end-user experience metrics, such as average page load. So, Monitis has extend the general API with a new version expressly for Google Analytics clients.

To do this, one of the best options available for us was, of course, Java — which is fully supported by Google Analytics libraries. For using the new package, it is necessary to download the Google library data, which is available at code.google.com, plus the Monitis Java SDK — available on github.

Every Google Analytics monitor is identified with three parameters: username (Google account), accountname and profilename. The three values identify the monitor on the dashboard. This has been a necessary choice because every account can contain different profiles associated with different Google Analytics accounts.

The heart of the package is the GoogleMonitor Java class — which contains four methods available to the user:

1. Googlemonitorexists: Check if the monitor identified by username, accountname, and profilename really exists.
2. deleteMonitor: Delete the monitor using three parameters (username, accountname, profilename) — if it exists
3. writeValues: Retrieve values from Google Analytics and write on the Monitor Dashboard with the period selected:

    • start date and end date
    • time of query
    • number of pages seen in the period
    • number of visitors; average load page time

You can also expand the set adding new fields to the monitors on the dashboard.

4. addGoogleMonitor: Create a new monitor on the dashboard identified by username, accountname, and profilename (see monitor details screenshot). In the figure, it is possible to see that the monitor contains the three fields — again, username , accountname, profilename — that identifies it, and it contains the five fields to show values retrieved from Google Analytics.

The package also contains a test class that you can use to create a monitor, get values from a Google Analytics account, and finally, delete it.

To test, it is necessary to edit the properties file with the values: Monitis API Key, Monitis Secret Key, and the details of the login, Google Account password, and the account and profile used for Analytics. After doing this test, run it and see if a new monitor appears on the dashboard with the data taken from the Google Analytics account.

We hope that this information will make it easier for you to create a custom Monitis monitor — specifically for viewing Google Analytics on the Monitis Dashboard. Signup now for 15-days free trial.

Full source code for Google Analytics Monitis package is here – https://github.com/monitisexchange/Monitis-Java-Plugins/tree/master/GoogleAnalitics-Monitor

Read the original blog entry...

More Stories By Hovhannes Avoyan

Hovhannes Avoyan is the CEO of Monitis, Inc., a provider of on-demand systems management and monitoring software to 50,000 users spanning small businesses and Fortune 500 companies.

Prior to Monitis, he served as General Manager and Director of Development at prominent web portal Lycos Europe, where he grew the Lycos Armenia group from 30 people to over 200, making it the company's largest development center. Prior to Lycos, Avoyan was VP of Technology at Brience, Inc. (based in San Francisco and acquired by Syniverse), which delivered mobile internet content solutions to companies like Cisco, Ingram Micro, Washington Mutual, Wyndham Hotels , T-Mobile , and CNN. Prior to that, he served as the founder and CEO of CEDIT ltd., which was acquired by Brience. A 24 year veteran of the software industry, he also runs Sourcio cjsc, an IT consulting company and startup incubator specializing in web 2.0 products and open-source technologies.

Hovhannes is a senior lecturer at the American Univeristy of Armenia and has been a visiting lecturer at San Francisco State University. He is a graduate of Bertelsmann University.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.