Getting a user's marketing source from Google Analytics - api

I'm a backend developer who has no experience with Google Analytics, but I've a requirement to find a way to collect the Marketing Medium/Source for each user from Google Analytics and save it in my database, I've been searching and looking how to get it from an API request but I didn't find a way yet, could you guys help?

You can use the Google Python API to fetch the Google Analytics data. You can read more here.
Medium and Source information can be found out by using the dimension ga:sourceMedium
You can find more info about dimensions and metrics here
Following which you can setup a daily script and fetches the data from your Google Analytics account and dumps data into csv which you can successively load into your database using libraries such as psycopg2.

Related

Segment import from Google Analytics to BigQuery

I have my BigQuery and Google Analytics accounts linked. In Google Analytics I can filter users using segments and perform analysis on them. I want to use the same segment (that I have created in Google Analytics) in BigQuery so that I can filter users and further do the processing on filtered data. Is there any way I can import a segment from Google Analytics to BigQuery and then use it? I have tried to find solutions on the internet but no luck. Can you guys please help me with this?

Is it possible to automate the extract of Apple News / iCloud News Publisher analytics data?

I'm trying to set up a dashboard in Google Data Studio with Apple News analytics data as one of the sources.
I can see you can download this analytics data manually as a CSV - does anyone know a way of automating this extract? Automatically appending the data weekly to a BigQuery table would be ideal, or Google Sheets or directly into Data Studio if not.
Thanks.
You can load your CSV into BigQuery [1], or schedule a load job, and then use it in datastudio through a BigQuery reader package. Otherwise, if you do not need to append the data you can simply import it with other packages as "Custom JSON/CSV/XML" By Supermetrics.
[1] https://cloud.google.com/bigquery/docs/loading-data#supported_data_formats

Analyze data in Google Cloud Datastore using Google Data Studio

I am new to databases, and have some data stored as entities in Google Cloud Datastore. I would like to be able to analyze and plot this data in a web interface, and it seems like Google Data Studio provides an easy-to-use way to do this. However, I'm a bit confused as to how I can actually use the two interfaces together; it seems like either Google Cloud Storage or Google BigQuery could be a middleman in between, but I'm not sure how this might work. Could anyone advise on whether using Google Data Studio would be the best approach to plotting/analyzing data in Google Cloud Datastore, and if so, offer tips on how I could go about this? There are a large number of tutorials but it seems like none that I've found have explained how to load data from the Datastore into a useable file for Data Studio.
Thanks!
As Graham Polley says, the question is answered here. The workaround to connect Cloud Datastore to Google Data Studio is to first export Datastore entities to BigQuery, as explained in this guide.
Then see this in order to connect Data Studio to BigQuery tables.
Finally in this blog post, there's a tutorial for building a dashboard with Google Data Studio and BigQuery.

Working out which BigQuery query I am paying for?

I am new to BigQuery and I have a question regarding billing - I have a recurring (almost daily) charge on my account and I think it is related to a query I have embedded into a published Tableau report - people are viewing the report and I am being charged - however the charge is more that I am expecting. How can I track the charge back to the specific query to confirm which one is raising the charge?
Thank you for your help,
Ben
I would start by enabling audit logs and inspecting the logs.
Audit logs are available via Google Cloud Logging, where they can be immediately filtered to provide insights on specific jobs or queries, or exported to Google Cloud Pub/Sub, Google Cloud Storage, or BigQuery.
To analyze your aggregated BigQuery usage using SQL, set up export of audit logs back to BigQuery. For more information about setting up exports from Cloud Logging, see Overview of Logs Export in the Cloud Logging documentation.
Analyzing Audit Logs Using BigQuery: https://cloud.google.com/bigquery/audit-logs

Combine Google Analytics with external data

I need to merge my GA statistics with external data (stored in SQL but I can expose them by some web service). Perfectly all the data should be available in GA for reporting but I found no solution for import the data into GA.
Do you know any piece of software that can do this and present the merged results in some readable form to the user? It should meet the following requirements:
Should be a web application
Should not be a software-as-a-service solution (will be hosted in infrastructure provided by me)
Should provide some level of automation in data import
Analytics Canvas looks interesting but I wonder if there are any other applications.
Analytics Canvas is indeed a good option, it has really good data extraction and transformation capabilities, and handles nicely any data out of both SQL data sources and the most recent GA API.
Google Analytics allows you import data through the API and manually through the Web Interface. For example this is a very good article on integrating external CRM user data with Google Analytics. But Google analytics also support importing the following types of data:
Product Data
Refund Data
Cost Data
Content Data
User Data
You can also create your own custom dimensions and metrics and import that data into Google Analytics and view the results in your own custom reports.