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.
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:
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