Saving statistics to Google Analytics - google-analytics

I'm relatively new to Google Analytics and would like to have some inputs.
So I have a web application that people can install to create a backup and can do restores as well. The application has an API where you can see the statistics of the app i.e. number of backups made, restores made, and the number of clusters connected to this application.
Now I want to send these stats to google analytics with an interval of 10 minutes. I was wondering if I can send the status to Event with a unique UUID as Event Category, the backup/restores, or nodes as Event Labels and the number as Event Actions.
Is this the right approach to using Google Analytics Events? Or is there a better way to do it in GA? My requirement is I have to do it in GA or should I use a different hit type.

Given that we are talking API's you intend to use the Measurement Protocol?
And the UUID refers to the unique user? if so, you should look at the uid https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uid
As to using Events versus Hits, using hits is probably easier on the reporting.

Related

Firebase Analytics for User View in Android/Kotlin App

In My android application I am trying to achieve a page Where I want to show Some Graphs for Stats of App to Users Like Active Users , Avg Time Spent by all users who use the app, Global map indicating Users from which Country with Intensity or more
To what I know Firebase Analytics Provides such details but I think its only for Admin , That is only the people that have access to the project can view it
Is there a possibility of Bringing those Analytics Graphs , Data , Stats into the App to and Show the User ? I am trying to achieve this in Kotlin for a Android App.
Any Indicator or Clear Resource to read abt Would also be helpful With slight info on the part I am trying to Achieve.
Thanks in Advance
I believe you could achieve this by using the Google Analytics 4 Measurement Protocol API. The Measurement Protocol API allows developers to make HTTP requests to send events directly to Google Analytics servers. This allows you to measure how users interact with your business from any HTTP-enabled environment. Notably, this makes it easy to measure interactions that happen server-to-server.
You can use the Measurement Protocol on the following:
Tie online to offline behavior.
Measure interactions both client-side and server-side.
Send events that happen outside standard user-interaction (e.g. offline conversions).
You can go to this documentation for more information.

Hierarchy of Google Analytics for Multiple Builds of Same App

I am setting up Google Analytics Accounts for a Product which have multiple builds as frontend for same user base.
So we have one Product called X and have:
Web Build
Mobile Web
Android App 1
iOS App 1
Android App 2
iOS App 2 6.
The main point is identical APIs and User base is used in all platforms and apps. So if we have a user John Doe he can login in any of the web or apps.
We want to extract following information from Google Analytics.
Under User ID feature want, sessions aggregations of that user around all build and apps, but identifiable. So I can know that user John login to web yesterday and used mobile app today.
Each user belong to a customer (company) in our system. So want to segregate all information based on companies.
I already have achieved point 2 by creating a custom dimension in Google Analytics and believe that's the best way to do it.
Now need suggestions from Gurus on how to acheive point 1 using Google Analytics.
Either use single account and single property for all builds and apps
If yes, then how to identify those apps and builds in sessions
If I use multiple properties/apps in GA account then how to aggregate user sessions among all?
Looking forward to hear how guys around hand or should have handled this scenario. Cheers!
This question is extremely broad, IMO any answer your going to get is going to be primarily opinion based. So here is my opinion and a little extra info to boot.
The first issue you are going to have is that there is a difference between Mobile google analytics accounts and web analytics accounts. The two do not mix. Mobile analytics accounts insert screen views with a screen name. While web accounts insert PageViews with a document location.
There is no way to analyze between two different Google analytics web properties. Unless you intend your android and ios apps to run as websites and send it like its a webpage its not going to work. You could potentially download the data into your own system or big query and analyze it there. Comparing your custom dimension to see what the users have done differently. I would wonder at the quality of the analysis you will get as there will be no real way for you to compare the data and match it up beyond using your custom dimensions user id and possibly date.
I am adding this because I am not sure what your saving in your custom dimension.
The second issue you are going to have is tracking. Google analytics TOS does not allow you to send any identifiable information to Google.
The Analytics terms of service, which all Analytics customers must adhere to, prohibits sending personally identifiable information (PII) to Analytics (such as names, social security numbers, email addresses, or any similar data), or data that permanently identifies a particular device (such as a mobile phone’s unique device identifier if such an identifier cannot be reset).
You could for example send your companies customer id for John as a user_id but user_id is an internal valuable used for internal processing this is not something you can extract out via the api.
The User ID enables the association of one or more sessions (and any
activity within those sessions) with a unique and persistent ID that
you send to Analytics.
To implement the User ID, you must be able to generate your own unique
IDs, consistently assign IDs to users, and include these IDs wherever
you send data to Analytics.
For example, you could send the unique IDs generated by your own
authentication system to Analytics as values for the User ID. Any
engagement, like link clicks and page or screen navigation, that
happen while a unique ID is assigned can be sent and connected in
Analytics via the User ID.
The best you could do would be to create a custom dimension and send that with every hit username=johnscustomerId. Which you appear to have already done. This is what I have done in the past and it works perfectly well.

Export clickstream data from Google Analytics

I am trying to download clickstream data from Google Analytics but I am not able to get it in correct format i.e. time stamp, page-path etc. I have seen some post on BigQuery but I have never used SQL.
Is there an easy way to do this?
No, there is no easy way. Google Analytics does not expose the client id via the API, so you cannot get user level data, and time based dimension allow breakdowns to the minute only, which is not granular enough.
You could store a more precise timestamp and the client id as custom dimensions (you might need to check your local laws and/or the privacy policy of your company to see if that kind of profile building requires permission by your users in your country).
Then you could pull url per client id, ordered by timestamp, via the Reporting API. However that is not necessarily easy and on a large site you might run into the API limits.

Can a user have only non-interactive hits in Google Analytics

I want to test my script that send event to Google Analytics via Measurement Protocol. For testing I've created a new account and trying to send the following request using the following template:
http://www.google-analytics.com/collect?v=1&tid=UA-MY_TESTING_TRACKING_ID&cid=XXX&t=event&ec=AAA&ea=BBB&el=CCC&ni=1&z=123456
In Google Analytics reports on events I see nothing (no events at all as well as users and sessions). Now I am wondering if it is because my script is incorrect or because Google Analytics ignores non-interactive hits for users that have no previous "interactive" hits (i.e. hits without ni=1 parameters).
Does Google Analytics allows to see such users or each user must have at least one interactive hit?
I had, for a test, a couple of dozen hit send via curl on the command line, and they were being processed within minutes. CID had been randomly generated especially for the purpose. All hits where being sent with the non-interaction flag. Those were event hits like in the example from the original question.
I have seen those hits in the Behavior/Events report, so they are being properly collected. However "non-interaction" is to be taken quite literally, as they are not used in any session based metric - i.e. if you just send ni-events you will not generate sessions; if you send both interaction/non-interaction hits only the interaction hits will be used in session-based metrics. I am seeing a user count, so strictly speaking the answer to your question is yes, but number of sessions is displayed as zero (likewise for all related metrics).
Makes completely sense, but since the documentation (the last time I read it) talked only about bounce rates when it comes to non-interaction hits I did not think about it this way.

How to share a part of the site in Google Analytics

we have events listing website and events from different organizers are grouped (by URL), like -
www.site.com/organizer/event1
www.site.com/organizer/event2
www.site.com/organizer/event3
etc. How to give an organizer an access only to his/her part of the site's Google Analytics?
Easy way -
An organizer registers in Google Analytics
An organizer creates a counter in Google Analytics
An organizer sets this counter in his/her profile on our website.
We add this counter to our Google Analytics code on www.site.com/organizer/* pages
He/she clicks on some link in the profile and sees the GA stat only for own events.
The way I want it:
He/she clicks on some link in the profile and sees the GA stat only for own events.
Is this possible with some API to separate statistics for www.site.com/organizer/* and share a private link to it with organizer?
After reading your comments in another answer (which is basically just a copy of the comment I left on your question). I have changed my recommendation left in comment, think you should use the Google Analytics API for this.
Since you want to give others access to your own data I suggest you use a service account. You will need to do this in a server sided programing language, say PHP or C#.
Every night run a job that will extract the data you want though the Core reporting API. Store it in the database then create a page that will then display only the data you want to the different people. You will only need to run your job once per day as the data for previous days will never change. Wait at least 24 hours to get the data as data hasn't completed processing for 24 hours.
I am not sure what language plan on using but these tutorials should get you started: Google Service Account with PHP or Google Analytics API Authentication with C#
I would create different profile views with filters to include only the subset of data for the subpages.
This way, you can add a specific user access rights to that specific profile only, so they can only view that profile when they log in.
Create an include only filter which filters on Request URI: /organizer/event1, /organizer/event2, /organizer/event3 etc.

Resources