Obtaining data in Google Analytics session - api

I'm using Google Analytics on my website and I'm wondering if it's possible to make a Javascript call to GA to obtain certain information about the current visitor such as the persons current location.
Does GA have an on page API that allows to obtain sessions specific information?

Google Analytics does not provide data for single visitors (not via the API nor otherwise - this is a privacy thing) so the answer is no.
Besides most data in GA in drawn from the users browser anyway, so querying GA to get it would be an unnecessary roundtrip.
For location there a IP based services (for example ip2location.com) or the HTML5 geolocation API.

Related

Missing Google Ad Campigns in BigQuery

App Engagement Campaigns that are present in the Google Analytics Interface are not present in BigQuery.
All other campaign data gets transferred to BigQuery.
Is there a specific reason for this behavior in the transfer job?
The transfer job only uses the Google Adwords v201809 version of the API.
App Engagement Campaigns were only added in the newer Google Ads API.
You will need to set up a connection the the new API in order to pull in that type of campaign (as well as a host of other ad types).

How Third Party Apps are getting data without using Adwords Reporting API?

I was trying to develop an automated reporting tool for my company and its very difficult to get the Google API access, being a very large agency we are still not able to get that.
Having said that, when I tried using some other reporting tools, they retrieve all our account reports just by connecting them with one access permission (with google sign-in API).
Any idea how the third party apps are doing it so easily without any API access?
Here is a documentation to help you get started.
The Google Analytics Reporting API v4 is the most advanced
programmatic method to access report data in Google Analytics.
With the Google Analytics Reporting API, you can:
Build custom dashboards to display Google Analytics data.
Automate complex reporting tasks to save time.
Integrate your Google Analytics data with other business applications.
Currently, here are the languages supported, sample codes were also available.
Service application (Java, Python, PHP)
Installed application (Java, Python)
Web application (PHP, JavaScript)
You have also to take note these reason from the answer in SO post why we need to have access permission:
Security. If the end user has your credentials he can log into your google account and have access to all your data.
Latency. The API is not intended to be used on page load. If your page loads depend on it it may take a long time to load for your
users.
Quota. The API has a limited quota that will extinguish fast if you query it every time a user enters your website.
Design. Ultimately, the API was designed to be used by yourself extracting data offline not in real time by others.

Another account access my Analytics API

I want to build a dashboard to my clients access your respective website analytics. But, after some research, I'm stuck.
Let's imagine the scenario:
My Analytics Account:
Client X - websitex.com
Client Y - websitey.com
In my dashboard, when the cliente Y log in, the data (pageviews) of websitey.com is shown on graphics.
But, there's a way to do that? By the moment, the only thing i got is retrieve information for my logged account (my analytics ID), not the information about another account.
There's a way to use the Google API, or, I'll have a "separate database" to save data each website?
Sorry, I'm really lost at the moment.
You can only view Google Analytics Accounts that you are authorized to view. For some reason this is a source of major confusion (seeing that your are not the first to ask), although it should be fairly self-evident.
If you want to see data from your clients account you have to ask your client to add your Google email to the GA account. If an email address is added to multiple accounts you can, via the API, choose between the accounts. Clientside authorization (OAuth2) will only work as long as somebody is logged in via a client application (usually a browser). The practial effect is that everybody who is authenticated via OAuth against Google will see only his own GA accounts, not other peoples data.
If you want a serverside application to pull data from various GA accounts you need a service account. But even the service account needs to be added to the GA accounts.
You can use the core reporting API, but the API will not give you access to accounts that you are not authorized to look at; your client needs to authorize you (or your applications service account).

Twitter and YouTube Analytics API

When we login to analytics.twitter.com via our account we could see a brief explanation about our followers like interests and occupation etc.
I have a basic portal that users could logIn via their Twitter accounts and I was wondering that, Is it possible to retrieve those data who loggedIn to my portal via using API?
Those data gathered all under audience insight, and I would like to make a meaningful inference about the people who loggedIn to my portal related the quality of their audience and etc.
All in all, I only would like to know is it possible to retrieve those data via using APIs both for Twitter and Youtube?
There is no API available (from Twitter) that provides access to the data values on analytics.twitter.com.

How do I get Google Analytics data into a CMS without asking the user to authenticate?

I have a web application backend for my clients web site. Authorised staff can log in to the backend and view data.
I want to pull some data from Google Analytics to be viewed in the backend, but GA seems to insist that the user is logged in to their Google account themselves using OAuth2
I want to be able to authenticate the server not the user. They already have permission and it seems unnecessary and possibly intrusive to ask them to link their Google accounts to the GA account and possibly even have to create one first.
The server already has to supply a client id, client secret and an api key, so it's not as if there isn't already an authenticated connection.
I'm guessing that there must be a way to pass the Google Analytics account credentials to OAuth2 somehow but I am not that familiar with OAuth2
Is this possible and how would it be done. A simple example or a nudge in the right direction would be appreciated
There are similar questions around but the ones I have found do not answer my question in the way I need.
Yes you need to store the authentication, but you may be able to use Google Analytics Super Proxy for your needs. At the very least you can see its code on how it stores the authentication.
You authenticate once, input the data you need scheduled from the GA Reporting API, then take the data feed and use it to build charts in your intranet. Any user can view those charts without needing to login to GA themselves.