Segment import from Google Analytics to BigQuery - google-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?

Related

Can we import data from BigQuery into Google Sheets?

I'm only seeing how to load data to my bigquery database but i don't see any wiki or post to help me on my question : Is it possible to load data to an external source like google sheet from a bigquery database (that can go thought the cloud storage plateforme)
you can export data from BigQuery, yes. One way to bring BigQuery data into Google Sheets is with the new Google Sheets Data Connector, see the screenshot below for where you'll find this on the GS interface:
Once connected, you can then write an SQL query and pull this data directly into a Google Sheet.
Here's a link to some official documentation on this data connector: https://support.google.com/docs/answer/9077536

Is there a way to repopulate specific date of Google BigQuery data from Google Firebase Analytics?

I have setup link between Firebase Analytics and BigQuery. Today I accidentally deleted rows of data from yesterday (tablename_20190926). Is there a way to restore the data, if not, how do I repopulate the data from Firebase Analytics again for a specific date?
Firebase streams its analytics data to BigQuery from the moment you enable the integration. There is no way to repopulate BigQuery with Analytics data from Firebase outside of that stream.
You may be able to recover the data from within BigQuery though. See Restoring deleted tables in the documentation, and How can I undelete a BigQuery table?

Does Google Cloud Dataprep support importing Google Drive Sheets as data sources?

I'm importing datasets in Google Cloud Dataprep (by Trifacta) to perform transformations on my data sources. But I can't see Google Drive Sheets in the list after connecting them to Big Query Console. I'm about to use them as rules for my transformations.
I've already created another dataset and the problem persists.
Is it possible to import them or not supported yet?
Thanks,
You are right. According to the documentation Dataprep only supports native BigQuery tables and views as BigQuery sources.
You could try downloading your Drive sheets as csv and then creating a BigQuery table from it, or maybe you could create a load job from your external table into a new native table using:
SELECT * FROM my_dataset.my_external_table

Getting a user's marketing source from Google Analytics

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.

Get visitor Latitude and Longitude from Google analytics through BigQuery

I've been using BigQuery (SQL)for a bit but now need to get some more specific location data. At the moment, our Google analytics table schema has the usual:
geonetwork.Metro, geoNetwork.region etc etc - but the geoNetwork.city data is pretty hit and miss.
So I'm wondering if anyone knows how I can grab Latitude and Longitude from the Google analytics that feeds into BigQuery. I've read that lat and long is available in the Google analytics real-time reporting API - but wondering if there's a way to get it into bigquery.
Any ideas would be awesome and much appreciated!
BigQuery Export Schema is documented here and now contains lat/long columns.