How can I use the Google Analytics API to pull GA Account Change History? - google-analytics

I want to be able to pull the Change History report from Google Analytics... any ideas/help would be much appreciated!
*It looks like the AdWords API offers this function, but I need it for the Analytics API

You can't. The relevant API for this would be the management API, but that does not list a function to get the account history, so you do not have programmatic access to that.
You could probably write a script using a bowser automation framework like Selenium that logs into Google Analytics using your own credentials, navigates to the account history, downloads the HTML content of the account summary page and then parses it to extract the desired information, but that would not involve the Analytics API at all (and is nothing that can adequately described in a Stackoverflow answer).

Related

Is there any API call or any kind of feedback to know whether data is actually sent through google analytics collect endpoint?

I have settled my google tag manager as from the guide.
I have got in place a page that redirect just after the tag gtm-load is collected into the dataLayer. It's actually a "transition" page that should redirect instantaneously.
In this way I make sure google-analytics.com/r/collect is called, as I can see from the network ta of my browser, seems the only way to do so for an "instant redirect page".
However I need to test it from the back-end side.
Is there any way to have a feedback from Google Analytics about the data is actually sent? For example something like google-analytics.com/get/data/lastEntry, so that I can use a restAPI to check it out?
As far as I know, google analytics provide only metrics through a web page, and no actual data sent to.
Moreover there are some Rest API here but they are only for configuration purpose.
you might pass a JavaScript function as a hitCallback parameter of analytics send command and it will be called right after hit data were sent:
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#hitCallback
Here's an example of how to use it with GTM alongside another useful feature of eventcallback
https://www.simoahava.com/gtm-tips/hitcallback-eventcallback/
Hope this helps.
There is a realtime API in Google Analytics, so what I have done for testing is to call my test URL with utm campaign parameters attached. Then I made a call to the realtime API and filtered by my custom campaign.
The realtime API is fairly limited (no session based values, obviously, you cannot test custom dimensions etc), but at least this tells you if your hit has registered in GA.

Create a demo account that's usable with the Analytics Reporting API? [Google Analytics]

I need to test some things with a Google Analytics View, but the default demo account that Google offers does not allow user to use the Analytics Reporting API :
You cannot use the demo account with the Analytics Reporting API. Attempts to do so result in a permissions error: (403) insufficientPermissions.
Source
I just need to replicate a view with different data already.
Thanks for helping.
You cannot replicate views with data. A view will always start empty.
However you can simply register a Google Analytics account and send lots of bogus data (either by setting up a web page with tracking code and call it repeatedly, or set a cron job to fire call via the measurement protocol) (this will happen in realtime, so you need to wait a few days before you have enough useable data. There is not way to bulk-create hits for a longer timeframe).
If you just want to test the API it probably matter that much what data you use, so a mock account should work just fine.

Google analytics Embeded api with out Oauth authorize

How can i use gapi.analytics.auth.authorize without button..
I need it for customers, to track visits on their subdomain, and I have my analytics code on page, so they can't use button to authorize, need without it, automatically.
Any example?
Your question isn't very clear it is hard to understand what you mean by Button.
I think you mean that you would like to select data from YOUR Google Analytics account and display it on YOUR website.
To do this you will need to use a service account as apposed to Oauth2 (Oauth2 would popup with a new window requesting access). When you create the service account in the Google developer console take the service account email address. Give it access at the ACCOUNT level in the Google analytics admin section. It must be the account level this will then give the service account access to read your Google analytics data.
Quota: I am not sure what you are extending to do here but remember you can only make 10000 requests per day against your Google Analytics profile. After that you are cut off there is no way to extend this number. So I advice you to save the data in the database someplace you shouldn't request the same data more then once.
Example:
I suggest that you look for an example in what ever programing language you are intending to use. Again your question doesn't state anything about what language you will be using. Hello analytics API might be a good place to start but it depends upon the language the PHP one is way out of date I wouldn't bother with it. Also you cant use a service account with JavaScript so that one is out to.
Update figured out button
Embded api I think I have finally figured out what you mean by button. gapi.analytics.auth.authorize is used in the Google analytics embedded api. Which is JavaScript which it is not possible to use with a Service account. So the final answer to your question is
Answer: You cant remove the button from the Google Analytics Embded api the only way to login with JavaScript is to use Oauth2.
Advice: switch to PHP and use a service account to request data yourself. Or give each of your customers access to your Google analytics so they can login themselves.

Displaying Analytics Dashboard for Clients using Google Analytics

We have certain amount of clients and each of us will have their pages on our website. We have to show them the analytics for their particular page. For this, we have the data on Google Analytics according to pages.
On the client admin page, they should be able to view the analytics for their page. This has to be coming from Google Analytics.
I have tried using the Core Reporting Api, but that needs an authentication and one should have access to Google Analytics profile, which is not possible for clients.
So now, Is there a way, where the client can see the dashboard with data being pulled form Google Analytics without any authentication?
No, authentication is required to pull data directly from Google. You could use one 'global' Google account and keep that account authenticated through code so that your users can access that data.
Only other option I've seen is to automate the export of the CSV data (via email) and have a routine that pulls off the CSV data and imports it into a system for public/private use - such as in your example.
Hope this helps!

Can I share my google analytics result to someone else?

I work in a small company and we - as many others = use google analytics to monitor how well/bad our site is doing.
To access this information we put the google account's details (username and pwd) and off we go.
I now want to share this information with one of my clients but I don't want to give him my google account.
can anybody suggest the best way or the best practices to achieve this ?
Many Thanks
Lp
Given that you want to "publish it", you might want to extract the relevant data via the Google Analytics API, which provides read-only access, works just like an ordinary Google Data API--this way you can serve it from your own Site without restriction.
That still leaves the presentation of that data, but at least you have complete control over it.
the client can give you HIS account and you give his account view rights
You create anothe rgoogle account just for read only access, give it read access to your google analytics and send the password that client.
I dont really see the issue here ;)
Check out EmbeddedAnalytics. This is a service tailored specifically to allow you to define nice looking charts against your Google Analytics data and then embed them on to your site. The service utilizes the Google Analytics API.
(disclosure: I work with EmbeddedAnalytics).
You may now use Google Analytics Embed API for the purpose. Clients still do need to have Google account.

Resources