I've build a web based on Java using Spring MVC (database MySQL) . Now I'd like to add web analytic functionalities on it. For example, I need to know the duration of each session by user, what kind of transaction performed the most. etc.
What kind of API I can use for this ? Is Spring XD or Google Analytic the one I am looking for ?
You need to install Google Analytics on your pages. Place JavaScript snippet on every page of your application: https://developers.google.com/analytics/devguides/collection/analyticsjs/
You can track transaction via Tracking API. You can use JavaScript API or generic Measurement Protocol. You need to set up events: https://developers.google.com/analytics/devguides/collection/analyticsjs/events .
You can get reports via Core Reporting API: https://developers.google.com/analytics/devguides/reporting/core/v3/ .
Here is Java Quickstart: https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-java
Related
Google Analytics 4 allows new custom audiences to be created:
I want to do this programmatically through a web API, but I can't see any documentation. Is it possible to create audiences in Google Analytics 4 using an API?
Google have confirmed that "the creation of audiences is not yet supported in Admin API" and have raised a feature request. They've not given a timeline for implementation but suggested following the Google Analytics API Notify group for future updates.
I need to remember that even after this feature is implemented in the GA Admin grpc API, it will also need to be supported in the .NET client library that I'm using, so there will take some additional time.
Not sure when added, but...
Web API:
https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.audiences/create
.NET client:
https://googleapis.dev/dotnet/Google.Analytics.Admin.V1Alpha/latest/api/Google.Analytics.Admin.V1Alpha.AnalyticsAdminService.AnalyticsAdminServiceClient.html#Google_Analytics_Admin_V1Alpha_AnalyticsAdminService_AnalyticsAdminServiceClient_CreateAudience_Google_Analytics_Admin_V1Alpha_CreateAudienceRequest_Grpc_Core_CallOptions_
I want to add Google analytics manually on each pages and events in my website. Is there any ways to add Google analytics using REST api or any library in PHP. so i can track specific events of my website.
There is no REST API for Google Analytics. You will have to use one of the available libraries provided by Google.
To track particular events, you can use tag manager or simply use custom dimensions.
TL;DR, Google Analytics is great if all you ever use is their GUI dashboard. If you need API access, go with another service.
If you need to access analytics data programmatically, especially if you are using NodeJS, I suggest you use some other service besides Google. Their documentation is incredibly lacking, they try to pigeon-hole you into using a client library rather than steering you in the direction of a REST API, and authenticating is a nightmare. The new v4 API purportedly consists of a single endpoint that you need to query with a complex combination of HTTP body and query params. Again, documentation is nearly non-existent.
I need to get all My Analytics data in My Front-end . It's need to Be Handle All in Front-end using JavaScript ..
For Python & PHP Library is Available But I want to handle All in Front-end As It's Admin Side of Our App & want some fast Processing..
Any Suggestion or Example How Can I achieve that using JavaScript.
For starters you cant get ALL of your Google Analytics data. The api limits the number of dimensions and metrics you can request at a time. There is no primary key so once you select out that data there will be no way to match that data with a second request.
You can use a service account to extract the data using PHP or python and then display it using JavaScript. I am sure someone has gotten a service account working with JavaScript but for security reasons this is not something I would personally attempt.
Yes Finally Got the Solution :
As you Need TO user Your Service Account Key (.Json File) And Need To use Google Analytics Embedded API . & you can use Any chart Library in THis..
Find Below Link for More Information
https://ga-dev-tools.appspot.com/embed-api/
https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/
I have a number of cases in my ASP.NET MVC web app where I return a dynamic result (ContentResult which returns an rss feed in this case) from a controller action method rather than a view. In these cases how can I implement Google Analytics tracking?
You cannot include JavaScript-based tracking into RSS file, because as far as I can see from specification, there is no way to include JavaScript code/link into it.
As Matt explained, you need to use measurement protocol from Google or something similar and perform web request from your MVC action. This, however, will increase load on your web server. There are 2 other disadvantages with server-side tracking:
You will not be able to track additional information with this method like visit duration, bounce rate etc.
RSS is frequently downloaded by automatic tools and you stats will be very misleading.
You should consider those limitations when implementing your server-side tracking.
I have developed an APP that uses restkit and connect to my server. The server side was built using spring 3.1 and jackson to generate the rest objects.
Now I want to mesuare the APP trafic but I cant find a way for google analitycs track the rest querys.
is this posible?? any recomendation??
Thanks in advance
For Google Analytics you should add the Google Analytics iOS library to your application and perhaps tie Events to the different REST calls your app makes.
Otherwise you'd have to generate statistics yourself from your web server logs based on the requests coming from iOS User-agents.