How to Track Java Servlet Request with Google Analytics
I have a generic link http://www.mydomain.com/clickServlet
on different third party client pages with different parameter values ( http://www.mydomain.com/clickServlet?ID=123&A=123&B=123
). The link is a Java Servlet. Based on the parameter values, the request is redirected to the external domain.
I want to track this at the Java servlet level. Since I have no access to client pages (pages where my link) and redirected domains, I have to adjust tracking in Java-servlet which should record all the data, such as referer
, ip
, location
, user-agent
etc. whatever GA writes. I need a solution like when I pass java object HttpServletRequest
along with GA account details and GA records all details from request object.
Is this possible in the Google Analytics API?
source to share
Google has published an official API for sending data to Google Analytics. This is the Google Analytics Measurement Protocol . This is probably the safest solution because it is the "official" and documented API.
source to share
Try to try JGoogleAnalytics . It can track usage information on Java applications through Google Analytics. It can be used to collect usage statistics for utilities, plugins (Eclipse, IntelliJ, Netbeans, etc.), Client, Server, Staging, Desktop, or any Java application. Hence, allowing us to conduct usage and trend analysis when applying interest.
source to share