Categories
Development

Google analytics report parsing in Java 8

Google has deprecated Google Analytics API v3 in favor of its new reporting API (V4). New API is quite universal and easy to use and its java library gets the job done well with one exception: mapping result to Java types. It returns everything in strings and you have to parse the Reports yourself and map the values to your object. I recently had to load quite a lot of daily statistics from google analytics so I wrote a simple class which does this dirty work for me.