Data from Google Analytics - google-analytics

So Google Analytics does not have an API that we can use to get our data, so is there an efficient way to programaticly fetch the data collected by Google, without logging it locally?
Edit:
I would prefer a Python or PHP solution but anything will work.

Google just announced that they're making available a data export API for Google Analytics. It sounds like that's exactly what you're looking for.
Per their announcement, the feature's currently in private beta, but I figure it'll be rolled out to all accounts in coming weeks/months. Depending on your needs, you may just want to wait, instead of building a short-term hackish solution.
If you're interested, I presume that the functionality's being rolled out first to members of the Google Analytics Trusted Tester program.

Also, I forgot about this: I never actually completely implemented this for a client because the deal fell through...
But you can customize the dashboard to include the sections of Google Analytics that your report might need and have a scheduled email. If the reports do not need to be too detailed and if Google already aggregates the data in the way you need it, then this might work for you.

The Google Analytics API is now open to everyone and looks like it contains the full data set

Well, it depends on what you want to do with the data. If you only want to process part of it, then I don't think it is difficult.
Here's a basic web search with a hit explanations from Google and someone else:
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55561
http://blogoscoped.com/archive/2008-01-17-n73.html

There is a completely programmatic way to access the data using greqo(PHP), but the analytics class is in beta. Check it out here.
If beta is not acceptable, you can use a mixture of the XML and Yahoo Pipes to get what you need.
Basic Method
Obtain the tracking data in a usable
format – We can schedule Google
Analytics to email this as an XML file
on a regular basis.
Make the XML file accessible online –
By emailing an attachment to Google
Groups, the file is automatically
given a public URL.
Work out the URL of the most recent
report – Since Google Groups provides
RSS/Atom feeds for all messages, we
can easily find the URL of the most
recent message and therefore work out
the URL of the XML report.
Prepare the data for use – We need to
manipulate the XML and massage it into
a handy JSON format that we can use on
our blog, which can all be done using
Yahoo Pipes.
Taken from here.

I implemented a solution where we scheduled the analytics report to be emailed to a gmail account each day and I pulled the report on demand via POP3. It's pretty easy and works fast. I've heard Epic1 will do this for you as well. I'm researching that now.

If you're using Python, Pandas io is also very helpful. Pandas has an interface on top of the Google Analytics API. It's pretty simple to get up and running and integrates with Pandas so you get the aggregation, time series features, and other data analysis library features.
instructions on how to authenticate and shows examples: http://blog.yhathq.com/posts/pandas-google-analytics.html
more examples: http://quantabee.wordpress.com/2012/12/17/google-analytics-pandas/
I've also posted a few queries to get started
https://github.com/sk8asd123/ga_pandas

Its been a while since I had to deal with this, but Google Analytics has an XML output type, so you can parse that to get the data in your own system. However, I believe that there is no way to get the xml file programatically, so someone still has to go in and generate the file and feed it to your app.
Good question though, I'd love to see if there is a 100% automated solution.

We just released a product - Megalytic - that makes it very easy to create custom reports using data from the Google Analytics API. You can email these reports to others without sharing your Google Analytics account. Also, create links to reports, download as PDF, etc.

Related

Change Google Analytics report api language

I am working with Google Analytics report api
I want to know if API support lang change.
I've googled, but no information had been founded.
I want to make sure there is no language change support, before translating it myself.
I am creating UI, which supports "Korean".
You can not change the underlying language returned by a Google api. These are designed in English and the data is often stored in English as well unless they are strict strings submitted by a user in another language.
These string you will need to translate locally yourself.
You may want to consider sending a feature request issue tracker. While i doubt they would consider adding anything to the reporting api at this time since it will be discontinued in a year or so. Its worth bringing it up to them maybe they will add it to the data api for GA4

Firebase Reporting Options

All my app's data is stored in Firebase. I'd like to build some reports with my data that aren't necessarily accessible through the web/app front-end. I don't see any good options for this in the Console. Has anyone found a good reporting solution for Firebase? I am looking for something like Crystal Reports or just an easy way to render Firebase data based on a query.
Thanks,
Rima.
I found a issue with the solution above. Firebase stores its data in JSON format, which cannot be consumed by solutions such as BigQuery, because it is expecting JSONL format and you get an error. It beats me why Google are not providing an elegant solution when integrating between two of their products, but I believe they have something planned.
Firebase does not have any "built-in" reporting tools other than the defined querying APIs.
If your database is small, you dump the JSON from the Firebase Console and then manually run analysis on it.
If your database is large, you can upgrade to the Flame or Blaze plans and sign up for daily private backups. This will create a JSON dump in the background without affecting your database performance and store it in the cloud. You could then use tools to grab that dump and perform advanced reporting on it.
1) Via BigQuery
Official Docs:
https://cloud.google.com/bigquery/docs/loading-data-cloud-firestore
Codelab Walkthrough:
https://codelabs.developers.google.com/codelabs/modern-data-pipeline-firestore-bigquery-dataflow-templates/index.html?index=..%2F..next17
Connect whatever BI tool you want to BigQuery. Google Data Studio is
free as is Metabase. Almost every Enterprise BI tool has a BigQuery
connector.
From https://www.reddit.com/r/Firebase/comments/arps42/reportingbi_tools_and_firestore/
2) Via "Custom Data Sources"
Cloud Firestore (and probably Realtime-Db) has a RESTFUL API. Many popular reporting tools support "custom", "restful", "ajax", and/or "HTTP" sources.
You should search your favorite reporting tools, and internet search accordingly.
I can see that Stimulsoft seems to support custom/RESTFUL sources. A PowerBI data connector seems to provide a lot of latitude - https://github.com/Microsoft/DataConnectors
Of course, this means that you need to create several data sources, and they probably won't be as optimised as a built-in source type. For example, the report engine probably won't know how to translate any front-end UI filters into custom-source query filters. Perhaps some platforms support the ability for you to create your own adaptors.

Posting graphite events to Hosted Graphite

I'm using Hosted Graphite and trying to add deploy events to my grafana dashboard. I first attempted to use the method described here.
The metric is added to graphite with a simple line at the end of the deploy script:
echo "$HOSTEDGRAPHITE_API_KEY.events.$ENVIRONMENT.api.deploy 1" \
| nc -uw0 carbon.hostedgraphite.com 2003
I can show those data points in a simple graph, but using the annotations feature with the "regular metric query" doesn't seem to be adding anything to the graphs.
I'm more interested in using real events, based on: http://obfuscurity.com/2014/01/Graphite-Tip-A-Better-Way-to-Store-Events. This should allow us to tag the event with, for example, the commit hash or git tag. Unfortunately, I can't find anything in the Hosted Graphite documentation about how to get these data into graphite. I also can't find anything about it in the graphite docs.
Despite the lack of docs, I tried posting to a few endpoints, just hoping to get lucky. All of these returned 404:
https://${HOSTEDGRAPHITE_API_KEY}#www.hostedgraphite.com/api/v1/events
https://${HOSTEDGRAPHITE_API_KEY}#www.hostedgraphite.com/api/v1/sink/events
https://${HOSTEDGRAPHITE_API_KEY}#www.hostedgraphite.com/XXXXXX/graphite/events
where XXXXXX is the path prefix I have when accessing the graphite dashboard at /XXXXXX/graphite/dashboard.
I also tried contacting Hosted Graphite support but the "Support" link seems to go nowhere.
Hosted Graphite employee here.
UPDATE: We support Graphite Events and Annotations now: http://docs.hostedgraphite.com/advanced/annotations-and-events.html
We don't currently support events, but it is in development.
This is the reason there is no mention of this functionality in our documentation.
We do support annotations based on metrics.
Which support link didn't work for you? I'll get that fixed :)
You can email us at support+so# or on twitter, as you already discovered.
I'm sorry I don't have a better solution to tagging deploys right now ( it's something we want to be able to do too) but it should be available soon.
Please get in touch via email if there's anything else we can help with.
e
EDIT: We're using Intercom for support, do you have something like noscript/disconnect that might stop that from working?

Is there anyway to grab Google Analytics via some kind of API?

Basically I have an admin CP I've coded for all my sites and I'd love to integrate the information gathered by Google Analytics on it to avoid having to look at both sites every morning.
BTW I'm using PHP, but I would assume if something like this exists it would just be exported as XML.
Nope.
Here's how to use Yahoo Pipes to scrape your Analytics page
Alternatively, you can export reports and use them
There's an official API in private beta. I'm looking forward to it!
http://analytics.blogspot.com/2008/10/more-enterprise-class-features-added-to.html
Nicolas Lierman has developed an AIR application that uses an API of his own creation to gather Google analytics data. He refuses to puplish the API though as apparently it exposes some severe security flaws in Analytics interface. Google themselves have never published an API for it.
If you really want to proceed with your plan, you'll have to reverse engineer the interface yourself.

Does anyone know a good guide/book to interpreting results from Google Analytics?

I'm looking for a guide to interpreting results from Google Analytics. Also is there an API for accessing the data?
I'm looking for a guide to interpreting results from Google Analytics.
I like Advanced Web Metrics; it's come in quite handy. Recommended if you're at least somewhat familiar with analytics packages in general. Otherwise pick something a little simpler, like Google Analytics 2.0.
Also is there an API for accessing the data?
You can find the API here
Google released an Analytics API on Apr 21, 2009. As usual with Google, there are a few caveats:
It is in "public beta". Everyone can use it, but they reserve the right to modify the API at any time.
Most, but not all metrics and dimensions are available. You can mostly ignore this fact until you start doing advanced combinations.
Read-only access.
They provide full developer documentation and an Analytics API Google Group for discussion.
http://code.google.com/apis/analytics/
Note:
As a new SO user, I can't add any relevant links for this answer, so feel free to edit this post and add them in.

Resources