Export my analytics data and put them in a database - mysql

I am looking to export the analytics data towards a database sql. Do you know one tools who could help me?
Do you know how I can see on Google analytics the traffic resulting from a particular URL??
Thank you all!

You have several options:
UI export: in the top/right corner of your reports you should have an option to download data in various formats (XLS, CSV...)
API: you can use the reporting API to get it out in a programmatic/automated way
One thing you won't be able to do with the free version no matter what you try:
Reconstruct the entire analytics data: whether with the UI or API, you're limited to querying only 7 dimensions maximum at a time (eg ga:country, ga:deviceCategory etc...), and cannot combine certain dimensions together (no official list available, it's trial and error to find out), whereas there are dozens of dimensions available.
So the question for you becomes:
How much resources do I want to invest into partially reverse-engineering Google Analytics vs. the value it brings me vs. what it would cost to get alternative analytics solutions?

I found a cloud based solution which exports raw google analytics data to MySQL database. Setup is simple, all you need to do is add your Google Analytics connection and a database to which the data needs to be exported.
MySQL, PostgreSQL, SQL Server and BigQuery are the supported destinations. It creates a few custom dimensions in your Google Analytics account and Tag in Google Tag Manager to send hits to Google Analytics. Data is exported from Google Analytics to the selected destination every day.
I have been using it for last three months now. Hope this helps.

Exporting the analytics data is a thorny one.
My understanding is that paid GA usage allows the export of all collected GA data.
But free usage does not.
For free usage, all you are going to be able to do, realistically, is to create a report over your GA data (in Data Studio or Google Sheets) that contains the rows and columns you want, and then collect this information and squirt it into a SQL table. You are also liable to come up against sampling.
Re traffic from particular URL, the news is better: just filter on Hostname and Page.

Related

Google Analytics Reporting API vs Query Parameters

I am trying to build a centralized dashboard to display information from google analytics. I have researched about reporting API which helps in embedding charts directly form analytics dashboard and also on query parameters to store analytics data in local database such as MySQL. I wanted to know which would be easy to implement and which is more effective. I have more than 300 websites which are monitored on analytics through a single account, So the data is going to be huge. I t would be great if anyone could post a code snippet to access data from analytics and store it in the database. Thanks!
You can use the Google Analytics Reporting API v4, it is the updated version after Core Reporting API. The Query Explorer can help you to identify what data to extract.
There is also another alternative if you want easier data import/export. This Analytics Canvas can do the job.
For reference, see this SO post.

Google Analytics - Retrieve Real Time data to a database

I have been searching alot in the internet and can't find an answer.
Is it possible to retrieve real time data from GA to let's say MSSQL?
I would like to store these data somewhere so i can reuse them in some other applications to view real time data.
Yes the Real-time Google Analytics API lets you request the data for what is currently happening on your site. If memory services its basically the last 5 minutes of data that is returned.
There are a few things you should know.
the data that you can get is very limited because the data hasn't completed processing. Check dimensions and metrics reference.
The Real Time Reporting API, in limited beta, is available for developer preview only. Sign up to access the API.
It normally doesn't take that long to get access and you wont get an email from Google stating you have access. Just try again the next day if it works you are in.
Answer to question in comments:
Before you can request data from a Google API you need to register a project on Google developer console. Once you have done that you can find the project number on the settings page

how to push Google Analytics data into mysql tables

I see many tutos to download GA data to a google spreadsheet and refresh it automatically
but none to export data into mysql table(s)
Is it possible ?
If yes where can i find tutos or a freelancer with skills on this subject
If yes is it possible to store the data of several UA in the same table ?
Thx
Yes, you can do that with the Google Analytics core reporting api and you can use their query explorer to see what data you can pull from it.
Also here is all their libraries and sample code that you can use as a tutorial. As far as hiring someone, I would check out the job board here or odesk.com.
if you don't want to play around with code and development, just go ahead and use Analytics Canvas that provides easy data import via API from Google Analytics, which you can then easily export to SQL / MySQL / any other database. All using simple and intuitive graphic interface.
I usually use another solution that does not require coding — Skyvia tool: Google Analytics and MySQL Integration. It allows me to create a copy of Google Analytics report data in MySQL and keep it up-to-date with little to no configuration efforts. I don’t even need to prepare the schema — Skyvia can automatically create a table for my report data. You can load 10000 records per month for free — this is enough for me.

Limits to application building in Google Apps Script

We are a Google Apps for Your Domain enterprise account, and Real Estate brokerage. We want to build a web application that ties together several Google Apps services. It would be great if we could do it all in Google Apps Script, but at the same time may stretch the limits of what's possible in Google Apps Script. We do not have the time or resources to do full application development using Google Web Toolkit (GWT). Is a framework approach the right solution?
We want to build an application that allows our agents to create a real-estate listing record. Each record is large, with 300 - 400 form fields per record depending on the property type. Many of the fields are 'lookup' fields with specific values in either a select-list format, or multiple checkbox format. (e.g. roof-type = choose one: slate, shingle, rolled-roof; appliances = choose all: refrigerator, stove, dishwasher; etc.)
Each record will also need associated photos in original high resolution format and also smaller resolution sets for display in various contexts. Each record would have 24-50 1MB photos. I'm thinking that we could use and integrate Google Drive for the photos because the process can be simplified for the user to drag and drop a folder from desktop to Google Drive. Having the images stored in Google Drive, and only referenced from the application would solve part of the implied storage question. I read that there is a 200MB ScriptDb Quota in Google Apps Script so I can see that being a potential deal-breaker just for the 'data' alone. I don't have an exact database storage requirement, but I know we'll have 700 records to start and that number will grow to several thousand.
The users of the application are all internal, so GAFYD auth integration is a nice benefit.
There is no form api currently, so how do we create the data entry form in the first place? It appears we would need to manually create the form, or else create a sample spreadsheet to auto-generate the form. But then how do we enhance the form to modify the select lists and attach validation rules, and dynamic form behaviors like creating/showing/hiding additional elements based on user input (e.g. enter # of rooms; then enter dimensions for each room).
Another potential showstopper is the resizing of photos. We want access to original photos in order to create further marketing materials, however in the application UI we would need to use various sized images at smaller dimensions for efficiency. (e.g. show list of properties with one thumbnail to represent each record) I guess there would be methods in the Google Drive api to create sub-folders to store the resized images, but is there access to graphics manipulation software like gd (maybe through an API to picasa)?
A record should be viewable in different layouts and views. For example full record detail, summary view, marketing flyer view.
Once a record is created, messages need to be sent to the agent creating the record, plus an internal team who processes the record for workflows including copy writing/review + marketing. That seems to potentially fit with the new Google Groups? Once the record is 'approved' then the application needs to generate a marketing email to several hundred external recipients; selected based on business rules from various pools. So the application would need additional storage, or possibly address-book integration to be able to manage contacts.
Future edits to records (e.g. price changes, photo changes) need to trigger the review/approval workflow.
Is Google Apps Script capable of handling the size, scope and complexity of this type of application? Or, would the recommended route be using a micro framework such as http://bcosca.github.com/fatfree/ to tie together all the Google Apps components using their respective APIs?
There is no form api currently, so how do we create the data entry
form in the first place?
There are two, actually: both UiApp (and the drag-and-drop GUI Builder for it) and HtmlService can show arbitrarily complex forms.
I'm thinking that we could use and integrate Google Drive for the
photos because the process can be simplified for the user to drag and
drop a folder from desktop to Google Drive.
Drive is integrated with Apps Script.
I don't have an exact database storage requirement, but I know we'll
have 700 records to start and that number will grow to several
thousand.
You might want to try Google Cloud SQL as your storage, which is 100% natively supported in Apps Script and is a "real" SQL database. However, several thousands records is tiny if you are storing the photos in Drive... ScriptDb could probably scale to several million records in that case.
Google Groups and Contacts are integrated.
Google's documentation can be found here: https://developers.google.com/google-apps/
Google Apps Script is sometimes surprisingly powerful, but it won't be very fast for the amount of data you're implying.
As you said, ScriptDB has a size limit, so it can't store everything. Spreadsheets are limited to 256 columns per sheet and 400000 cells. My way around this is splitting my data into a set of spreadsheets with a set of sheets. If you're in real estate, you can probably split your data by region and neighborhood/area to achieve something similar. If you really want to compact things, you can store a row of data as a stringified JSON object in one cell. However, it will no longer be human-readable.
Unless you're willing to pay extra for storage, it sounds like your pictures will fill up a Drive account fairly quickly. I'm not familiar with images in gadgets, so I'm not sure if they can be embedded from Drive.
I have no experience with Forms, but you can build a gadget using UiApp and call appendRow on a spreadsheet sheet to add the contents of all your fields. And by building your app like that, you can specify valid values for things (and have those read from a "config" spreadsheet).

Archiving data in spreadsheets

I have implemented a time booking system based on spreadsheets which the users fill out and then are consolidated into one central (and big) spreadsheet.
After having had a few performance issues the whole application now runs perfectly since several months. However, I will soon run into the size limitation of spreadsheets (400k cells).
In the consolidated spreadsheet I basically do not need more data than the current month. However for statistical purposes I would appreciate if I could make the data easily accessible for the domains users.
Basically the BigQuery Service would be perfect but I did not find an API to write data to it from a spreadsheet. I hesitate to use the Google provided MySQL database for cost reasons.
Are there any other ideas around?
There's a built-in Google BigQuery API for Apps Scripts, you just have to enable it manually under Resources > Use Google APIs. There's also Fusion Tables, that does not have a built-in API but is somewhat simple to use via UrlFetch.
Anyway, if it's statistical purposes, why don't you just "compile" the data in another spreadsheet? e.g. month - amount of entries - total prices - avg etc - etc...