Google Analytics Mobile SDK "request for permission" requirement - google-analytics

The Google Analytics Plugin for PhoneGap has an example app that contains the following code:
// Note: A request for permission is REQUIRED by google. You probably want to do this just once, though, and remember the answer for subsequent runs.
navigator.notification.confirm('GA_PLUGIN would like your permission to collect usage data. No personal or user identifiable data will be collected.', permissionCallback, 'Attention', 'Allow,Deny');
I've looked through the Google Analytics mobile SDK docs (although I have not read them start-to-finish) and have been unable to locate this requirement. I also don't see it in the Terms of Service at http://www.google.com/analytics/terms/us.html.
I don't mind requesting permission from the end user, but I certainly don't do it on web sites and I don't seem to recall getting many of these requests within apps that I've installed either.
Is the comment in the code correct?

Found it! Sort of. It's in the Measurement Protocol / SDK Policy doc. It states:
You will give your end users proper notice about the implementations and features of Google Analytics you use (e.g. notice about what data you will collect via Google Analytics, and whether this data can be connected to other data you have about the end user). You will either get consent from your end users, or provide them with the opportunity to opt-out from the implementations and features you use.
That's the Measurement Protocol / SDK Policy. It's not 100% clear to me that it refers to the iOS and Android SDKs. On the one hand, the table of contents type thing on the left has it under Measurement Protocol > Resources. The iOS and Android SDKs are outside of Measurement Protocol. So that suggests it doesn't apply to the iOS and Android SDKs. On the other hand, the Measurement Protocol doesn't seem to have an SDK associated with it, so that the suggests that "SDK" in the title may be referring to the iOS and Android SDKs.
I do wish this were clearer.

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.

GA4 client id issue

We are trying to migrate from Universal Analytics to GA4. The issue we are having is that GA4 requires a client_id field which we cannot get in a desktop application (C++). Is it possible to get client_id without a browser? and without being an IOS or Android app?
Just generate a unique id for each user, that's it. That's exactly what GA does on web. Same applies for GUA. I wonder how you were tracking users without setting client id for UA. Were you tracking them?
Another thing is that despite all the fuss around GA4, it is an unfinished product. Even though Google recommends it, the professionals who actually work with GA's data recommend to either not use it and give it another year or two or implement it very shallowly in parallel with existing tracking just to have some semblance of historical data in it when it's time to switch.
Finally, if you're tracking a desktop app, you likely use the measurement protocol rather directly, so you mind find this useful: https://firebase.google.com/codelabs/firebase_mp#2

Avoiding Google Tag Manager blocking by AdBlockers

I have used Amplitude analytics in the past in my react Web app to send event data. However I just started with Google Tag Manager and noticed it does not run because being blocked by adBlockers. Amplitude was always functional because I loaded their Javascript SDK through NPM install 'github:amplitude/Amplitude-Javascript' and initialized it at app load with client API key. I like the approach of Google Tag manager where I dont have redeploy app to make changes to my analytics logic. How can I take a similar approach to avoiding being blocked by adblockers.
It may very well be that Google products are popular so Adblock specifically just block google analytics products not other analytics products.
You don't. If people don't want to be tracked, that is their decision. You should not be forcing people to provide you with any data they do not want to provide. Especially by using some shady "bypassing" measures. Instead-
You could use a cookie to permanently disable your tracking of those who do not wish to be tracked, to help you preserve reliable analytics. See: http://www.multiminds.eu/2016/05/19/how-to-disable-tracking-via-google-tag-manager/
Or, better yet, simply measure the percentage of visitors who have disabled tracking so your analytical data can remain accurate. See: https://marthijnhoiting.com/detect-if-someone-is-blocking-google-analytics-or-google-tag-manager/
Yes, it's possible.
You can use reverse proxy for Google Tag Manager.
First, download the Google Analytics JavaScript library itself and host it on your server.
Then alter the code in the downloaded library to change the target host from www.google-analytics.com to your own domain name using find-replace.
Replace the link from the default Google Analytics script in your codebase to modified one.
Create a proxy endpoint to Google Analytics servers on your back end. One important step here is to additionally detect the client’s IP address and write it explicitly in requests to Google Analytics servers to preserve correct location detection.
Test the results. You’re done!
more detail info on freecodecamp.org/news/save-your-analytics-from-content-blockers and https://analytics-bypassing-adblockers.netlify.com
There's dataunlocker.com as well as some other open source alternatives (1, 2) which can help to fix reporting accuracy of Google Tag Manager, Amplitude, Google Analytics etc.
Talking about ethics and privacy, tools like DataUnlocker are just tools which allow you to bypass ad blockers as if you have implemented server-side analytics. I think by correctly implementing that "we use cookies" consent one can solve any privacy concerns.
I've managed to get around some blockers with the following in a node app:
var request = require('request');
app.get('/proxy*', function(req,res) {
const newurl = req.url.split('/proxy/')[1];
const data = request(newurl);
//data.on('response', function(response){console.log(JSON.stringify(response))});
data.pipe(res);
});
Then in your snippets for GTM prepend: "/proxy/" in the url and now the call goes via your server.
The caveat with the above is that without additional code you can't preview the container, but the container does load correctly. Lack of preview is a different issue to deal with.

Handling Google analytics in an offline enabled web app

I am a developer of Codiva - java ide and online compiler. I am working on improving offline support, reducing network usage, reducing the latency by pre-caching as much as possible.
I want to know how to handle requests to google analytics.
First is the ga script. I use google tag manager to setup GA. Is it okay to cache that request, that is, can I use networkFirst strategy for this request? Or should it always be networkOnly?
How to make sure the actions that happened offline gets tracked correctly?
I am planning to start using Firebase for some featuers, firebase also has some kind of analytics. Would it automatically handle analytics when the device goes offline?
Use the Service Worker helper for Google Analytics:
https://developers.google.com/web/updates/2016/07/offline-google-analytics?hl=en
Try PWA Template https://github.com/StartPolymer/progressive-web-app-template
First is the ga script. I use google tag manager to setup GA. Is it okay to cache that request, that is, can I use networkFirst strategy for this request? Or should it always be networkOnly?
I'm not sure it's wise to cache the GTM script. The analytics.js script is relatively static, but the GTM script can be updated by anyone who has access to your GTM account. Changes made in there obviously wouldn't get propagated to users of the cached version of the script.
How to make sure the actions that happened offline gets tracked correctly?
The key is to use the qt parameter, which allows you to send a hit after the fact, and specify its time offset.
There's an unofficial service worker script that does this today that you should take a look at. It will probably become officially supported sometime soon:
https://gist.github.com/jeffposnick/466ef7578c4c880a78c7270e6ac69620
I am planning to start using Firebase for some featuers, firebase also has some kind of analytics. Would it automatically handle analytics when the device goes offline?
At this point Firebase analytics is mobile-only. If you're using their web SDK, I don't think you get any analytics at this point.

How is Google Analytics Measurement Protocol different?

I was checking GA Measurement Protocol to send data to GA from backend.Which is working fine.Url i am using is:
https://www.google-analytics.com/collect?tid=UA-XXXXXXX-1&v=1&cid=9350&dp=home&t=pageview
(Please replace UA-XXXXXXX-1 with your own tracking id.)
Now i have a website which is GA enabled using javascript way.I checked in Chrome inspect that it sends information to google through url:
https://stats.g.doubleclick.net/__utm.gif?utmwv=5.6.5dc&utms=4&utmn=1588741400&............
I can use this url too to send information to google from backend. What's special and new in Measurement Protocol because using this url too i can send data to google for analytics purposes?
I need to send data from backend to GA so please guide.
The measurement protocol is now the "backbone" for data collection for Universal Analytics for all versions (web, mobile etc). Unlike the gif-method it is well documented and it can be called from every device/programming language that can send http requests (it will still return a transparent gif, though).
The main reason for using the measurement protocol is that everything else is deprecated and Google has announced that support for older tracking methods will be dropped. It looks like your second example uses an older version of the Analytics tracking code, current versions send their calls to the https://www.google-analytics.com/collect endpoint. You should not invest a lot of effort in developing solutions based on deprecated technology, especially if it offers no advantages over the current versions.
Google measurement protocol is very useful when implementing distributed solution of a service like restful APIs.
The client is not known by the server, each client world wide can call the rest API so no javascript code is possible to be injected at the client.
Measurement protocol enabled us to track which kind of devices are calling our API, how many requests per endpoint, etc...

Resources