Marketing Watch House
Marketing Watch House
  • 79
  • 229 054
Google Ads Automation with Python - Getting Report in Pandas and Excel
Let's go through the code and learn how to use Interactive Google Ads Query Builder!
Timecodes:
00:00 Introduction
00:18 GAQL limitations
01:34 Getting raw report
05:16 Building dictionary
07:30 Converting to pandas
08:55 Saving report as CSV or XLSX
11:25 Your Homework :)
Useful Links:
1. Download Python www.python.org/downloads/
2. Download PyCharm www.jetbrains.com/pycharm/download/#section=windows
3. Official Library github.com/googleads/googleads-python-lib/tree/ca06aaae68c1cfea8bc80be1f019980c2caec5dc
4. My Source Code github.com/RPetrochenkov/google_ads_tutorials
5. GAQL Builder: developers.google.com/google-ads/api/docs/query/interactive-gaql-builder
This tutorial playlist: th-cam.com/video/cKODT6-u_bA/w-d-xo.html
Google Ads into BigQuery Playlist: th-cam.com/video/Hi80puAbDH0/w-d-xo.html
Read me on Medium: medium.com/@rpetrochenkov
Add me on LinkedIn: www.linkedin.com/in/rpetrochenkov/
My other Google Ads Scripts tutorials: th-cam.com/video/c2JjxqgsbJ4/w-d-xo.html
มุมมอง: 7 095

วีดีโอ

Google Ads Automation with Python - How to Build Reports in API and Python
มุมมอง 7K4 ปีที่แล้ว
Let's go through the code and learn how to use Interactive Google Ads Query Builder! Timecodes: 00:00 Introduction 01:42 What is GAQL (query language) 03:49 Variable: query 06:00 Getting response: search_stream 07:19 Parsing data: batch 08:21 Parsing data: row 10:09 Parsing data: match types 11:48 Exception explanation 12:48 Creating report in GAQL Useful Links: 1. Download Python www.python.or...
GA4 + BigQuery Tutorial - Creating EVENTS Level Table (#5)
มุมมอง 7K4 ปีที่แล้ว
Here is a step-by-step tutorial on creating hit level (event level) GA4 table. Important code template for you: WITH table1 as (SELECT * FROM ...), table2 as (SELECT * FROM table1) SELECT * FROM table2 Timecodes: 00:00 Intro 00:45 Renaming columns 02:30 Going through schema in details 05:29 Moving params to columns 08:31 Creating event level table 11:15 Aggregating metrics 12:26 Reading final t...
GA4 + BigQuery Tutorial - Creating Sessions Table (#6)
มุมมอง 5K4 ปีที่แล้ว
Now we are going to convert events table into sessions table. We don't need to use any new SQL functions, just aggregate existing hits. Important code template for you: WITH table1 as (SELECT * FROM ...), table2 as (SELECT * FROM table1) SELECT * FROM table2 Timecodes: 00:00 Intro 00:35 Schedule Query Advice 01:27 Fixing 03:28 Session level query 07:05 Counting conversions Useful links: 1. Crea...
GA4 + BigQuery Tutorial - Page Visit Conversion Field (#7)
มุมมอง 2.2K4 ปีที่แล้ว
In this video I show you how to count page_views as conversions. Timecodes: 00:00 Intro 01:05 Writing code 03:10 Other advices Useful links: 1. Create Google Console here: console.cloud.google.com/?pli=1 2. Open BigQuery here: console.cloud.google.com/bigquery 3. Great guide on how to connect GA4 with BigQuery: online-metrics.com/ga4-bigquery/ 4. Great article on GA4 BigQuery for beginners: www...
GA4 + BigQuery Tutorial - Getting session_id Using Window Function (#4)
มุมมอง 6K4 ปีที่แล้ว
Step-by-step tutorial on how to assign session_if to each hit inside GA4 (firebase) table. Your code template №1: MAX(CASE WHEN params.key = "ga_session_id" THEN params.value.int_value ELSE NULL END) OVER (PARTITION BY event_timestamp, user_pseudo_id) AS ga_session_id Your code template №2: SELECT * EXCEPT (column_name1, column_name2) FROM ... Timecodes: 00:00 Intro 01:05 Window Definition 03:0...
GA4 + BigQuery Tutorial - How to UNNEST hits in GA4 (#3)
มุมมอง 11K4 ปีที่แล้ว
Here is a step-by-step example how to unnest hits inside GA4 (firebase) events data. Your code template: SELECT * EXCEPT(event_params) as events FROM table LEFT JOIN UNNEST(event_params) as params Timecodes: 00:00 Intro 00:45 Problems in Schema 01:30 How event_params look like 02:59 UNNEST-ing params 04:30 Result after UNNEST 06:00 Calculating first metrics Useful links: 1. Create Google Consol...
GA4 + BigQuery Tutorial - How to Access Any Date Period (#2)
มุมมอง 8K4 ปีที่แล้ว
Having trouble working with nested tables in the Big Query? Here is a simple tutorial to access any dates in the table. Timecodes: 00:00 Introduction 00:32 How dates impact tables 01:25 All Date Ranges 02:20 Using Table Suffix 03:12 Custom Date Ranges 04:20 Excluding streaming events 05:15 Checking your filters SQL Function: PARSE_DATE("%Y%m%d", _TABLE_SUFFIX) Useful links: 1. Create Google Con...
GA4 + BigQuery Tutorial - How to Import Google Analytics to Big Query
มุมมอง 18K4 ปีที่แล้ว
Step-by-step tutorial how to import data from a new GA4 analytics to Big Query project. Timecodes: 00:00 Introduction 00:50 GA4 Set Up 01:30 Import Settings 02:50 BigQuery View Useful links: 1. Create Google Console here: console.cloud.google.com/?pli=1 2. Open BigQuery here: console.cloud.google.com/bigquery 3. Great guide on how to connect GA4 with BigQuery: online-metrics.com/ga4-bigquery/ 4...
Google Ads Automation with Python - Running Any Script API Tutorial (#2)
มุมมอง 5K4 ปีที่แล้ว
Here is step-by-step instruction on how to start working with Google Ads with Python and API. Just an addition to the first series. 00:00 Intro & Talk 00:51 New Git Hub Project 02:20 Credentials 03:12 Config Data 04:51 Test Google Access 06:03 Make your own script 08:29 Questions Useful Links: 1. Download Python www.python.org/downloads/ 2. Download PyCharm www.jetbrains.com/pycharm/download/#s...
Google Ads Automation with Python - How to Connect to API Tutorial (#1)
มุมมอง 54K4 ปีที่แล้ว
Here is step-by-step instruction on how to start working with Google Ads with Python and API. Try to watch in 1.5x speed if it's a bit too long :) 00:00 Intro & Talks 01:24 Yaml Credentials 02:57 Python & PyCharm 03:59 Google Ads Library 04:57 Getting Developer Token 11:14 Getting Client ID & Secret Id 13:00 Getting refresh token 15:40 Running your first script Useful Links: 1. Download Python ...
Big Query SQL Tutorial - Keyword & Criteria Tables Miss Match (Part #11)
มุมมอง 6444 ปีที่แล้ว
Have you ever wondered what's the difference between Keyword and Criteria tables? Or you probably even didn't know, that one of them exists. Here is a short video on main pain point about Google Ads Big Query dataset when you work with Keywords. Useful links: 1. How to Set-up BigQuery and Everything you need to know th-cam.com/video/Hi80puAbDH0/w-d-xo.html 2. How to Import Google Ads to BQ: clo...
Big Query SQL Tutorial - Scheduled Queries How To (Part #10)
มุมมอง 9K4 ปีที่แล้ว
View is one of the coolest things in BigQuery. It allows you to pre-save your SQL instead of re-writing is all the time and access the data any time. View doesn't require any additional storage for it, because BQ doesn't store the table itself, only the SQL. So each time you access the view, the result will be recalculated. 00:00 Rewind 00:28 Scheduled Query vs. View 03:20 Creating Scheduled Qu...
Big Query SQL Tutorial - View Explained (Part #9)
มุมมอง 4.5K4 ปีที่แล้ว
View is one of the coolest things in BigQuery. It allows you to pre-save your SQL instead of re-writing is all the time and access the data any time. View doesn't require any additional storage for it, because BQ doesn't store the table itself, only the SQL. So each time you access the view, the result will be recalculated. 00:00 Rewind 00:25 Why we use Views 01:25 Creating example SQL 05:20 Da...
Google Ads Scripts - Simple Bidding Tutorial (GAS #15)
มุมมอง 1.7K4 ปีที่แล้ว
A simple tutorial how to build a primitive bidding system in Google Ads Scripts using the stats of a keyword. This script is only an example. But going deep enough, you can construct a real production-ready script for your accounts. Possible withCondition column names: developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_keywordselector#withCondition_1 Possible stats for keywor...
Big Query SQL Tutorial - Custom Conversion Data (Part #8)
มุมมอง 1.4K4 ปีที่แล้ว
Big Query SQL Tutorial - Custom Conversion Data (Part #8)
Big Query SQL Tutorial - Combine queries together using WITH
มุมมอง 1.9K4 ปีที่แล้ว
Big Query SQL Tutorial - Combine queries together using WITH
Big Query SQL Tutorial - advanced JOIN practice (Part #6)
มุมมอง 1.8K4 ปีที่แล้ว
Big Query SQL Tutorial - advanced JOIN practice (Part #6)
Big Query SQL Tutorial - How to easy JOIN tables (Part #5)
มุมมอง 6K4 ปีที่แล้ว
Big Query SQL Tutorial - How to easy JOIN tables (Part #5)
Big Query SQL Tutorial - How to Filter by SUM, COUNT or Aggregation (Part #4)
มุมมอง 2.2K4 ปีที่แล้ว
Big Query SQL Tutorial - How to Filter by SUM, COUNT or Aggregation (Part #4)
Big Query SQL Tutorial - How To SUM and COUNT (Part #3)
มุมมอง 4.9K4 ปีที่แล้ว
Big Query SQL Tutorial - How To SUM and COUNT (Part #3)
Big Query SQL Tutorial - How To Select (Part #2)
มุมมอง 3K4 ปีที่แล้ว
Big Query SQL Tutorial - How To Select (Part #2)
Complete Guide To BigQuery for Google Ads - Introduction (Part #1)
มุมมอง 18K4 ปีที่แล้ว
Complete Guide To BigQuery for Google Ads - Introduction (Part #1)
Google Ads Scripts - Apply Callouts - Final (GAS #14)
มุมมอง 2435 ปีที่แล้ว
Google Ads Scripts - Apply Callouts - Final (GAS #14)
Google Ads Scripts - Apply Callouts (GAS #13)
มุมมอง 1985 ปีที่แล้ว
Google Ads Scripts - Apply Callouts (GAS #13)
Google Ads - How To Add Promotion Extensions In Scale (Easy in Use)
มุมมอง 2705 ปีที่แล้ว
Google Ads - How To Add Promotion Extensions In Scale (Easy in Use)
Google Ads Scripts - Auto Callouts Creation in Scale (GAS #12)
มุมมอง 3085 ปีที่แล้ว
Google Ads Scripts - Auto Callouts Creation in Scale (GAS #12)
How to Improve Google Sheets Reports in 5 minutes with Named Ranges
มุมมอง 3025 ปีที่แล้ว
How to Improve Google Sheets Reports in 5 minutes with Named Ranges
Google Ads Scripts - Loading Data from Google Sheets (GAS #11)
มุมมอง 6325 ปีที่แล้ว
Google Ads Scripts - Loading Data from Google Sheets (GAS #11)
Google Ads Scripts - Loading Data from Google Sheets (GAS #10)
มุมมอง 5865 ปีที่แล้ว
Google Ads Scripts - Loading Data from Google Sheets (GAS #10)

ความคิดเห็น

  • @Jason-GBDMarketing
    @Jason-GBDMarketing 23 วันที่ผ่านมา

    Great tutorial! I have spent hours trying to find the correct table. I'm connected to my MCC account. Do you know where google ads "Account Status" is stored? Like enabled, canceled, etc.? Or if you can see if an account is "Hidden"? Is this data not transfered to bigquery? That wouldn't make sense. Any help is appreciated.

  • @andreifranck2374
    @andreifranck2374 3 หลายเดือนก่อน

    Hi there i connected BQ with powerbi but that was two months ago and the data is starting to be exluded the first days how can i get this backfill of months before and when it updated the data every day don´t exclude historical data of google ads? please save me lol

  • @XavierWallach
    @XavierWallach 4 หลายเดือนก่อน

    So, if I want to look at year on year data in a Looker Studio chart, I'd have to just use INTERVAL -720 DAY in the command?

  • @golnoush7245
    @golnoush7245 4 หลายเดือนก่อน

    Amazing video, though if you remove low-performing keywords from the campaign, can you apply the updated version to the campaign directly? or we should give a list to marketers and then they modify through the account ?

  • @MrCutler15
    @MrCutler15 5 หลายเดือนก่อน

    Bless you bud. May Our Lord Cthulhu consume you last

  • @АлександрБердышев-с5ы
    @АлександрБердышев-с5ы 5 หลายเดือนก่อน

    Google tokens system is very bad!

  • @Sealaholic
    @Sealaholic 7 หลายเดือนก่อน

    A wonderful video which solve my problems perfectly ! Thank you !!

  • @iamnimeshpatel
    @iamnimeshpatel 8 หลายเดือนก่อน

    wonderful work. Keep Growing. Keep Sharing. 🙂

  • @romulohaliski
    @romulohaliski 9 หลายเดือนก่อน

    Hello, How i can send msg private for you? Tks

  • @quinnkrug1971
    @quinnkrug1971 9 หลายเดือนก่อน

    Campaign Basic Stats table does not have the Cost field. Do you have to specify to include that in the data transfer? I am trying to edit my data transfer and do not see the option.

    • @brunadefreitas1660
      @brunadefreitas1660 3 หลายเดือนก่อน

      hello, is the same field as metrics_cost_micros, and you divide by 1000000, I like to use SAFE_DIVIDE(metrics_cost_micros, 1000000) in my analysis

  • @MichaelHayes_s6
    @MichaelHayes_s6 10 หลายเดือนก่อน

    I'm not convinced that partitioning over the event_timestamp is the right thing to do Since the timestamp changes for each batch of events sent to BigQuery, so your session id will identify a group of events sent at once, rather than a group of events in a single session. I think this might be sufficient, though it won't be unique so you'd still need to combine with user_pseudo_id: (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id' ) AS ga_session_id

  • @allexandre888
    @allexandre888 10 หลายเดือนก่อน

    Does this {_cmp} automatically track the name of the campaign? I did not understand. Is it dynamic, and will it change/match according to my campaign name?

  • @rafael0000011
    @rafael0000011 10 หลายเดือนก่อน

    Hello Roman, how u doing? First of all thanks for the series of videos, it really helped me understand how to use the ga4 table, but I still have one problem and wanna know if you can help me. I have some events that have the same timestamp and when I do the max() thing with the parameters I loose these events, for what I read these events are batched and are sent multiple at once, and by that they have the same timestamp, do you know any way of bypass this problem?

  • @dannydxm
    @dannydxm 10 หลายเดือนก่อน

    You're a hero bro! Everything I managed to find online on the topic is junk compared to this!

  • @alekseew2011
    @alekseew2011 10 หลายเดือนก่อน

    Thank you very much for your video

  • @someone3835
    @someone3835 11 หลายเดือนก่อน

    So the dataset created on the next day, right? Or dataset create immediately, but it was empty on the first day?

  • @MuhammadIsmail-fe2uf
    @MuhammadIsmail-fe2uf 11 หลายเดือนก่อน

    Hi friends I have a Google Ads Manager account, and I applied for basic access almost a month ago, but I still haven't received any response. Does anyone have an idea of how long it typically takes to get basic access?

    • @alexforest1658
      @alexforest1658 2 หลายเดือนก่อน

      any update? What was your query

  • @kannadastocktrader3369
    @kannadastocktrader3369 11 หลายเดือนก่อน

    How to get session source medium and session campaign level data from big query which matches add pannel

  • @kannadastocktrader3369
    @kannadastocktrader3369 11 หลายเดือนก่อน

    How to match the data of session source medium and session campaign level session data by date wise

  • @bismareyneresquivelortuste7915
    @bismareyneresquivelortuste7915 ปีที่แล้ว

    Hey! Amazing content! You wrapped up everything. Thank you!

  • @duponce
    @duponce ปีที่แล้ว

    Wouldn't it be better to do the loop this way? // Queremos deixar apenas 1 anúncio ativo, o de maior CTR if (ad_array.length > 1) { // Verifica se há mais de 1 anúncio para processar for (var i = 0; i < ad_array.length - 1; i++) { // Itera até o penúltimo anúncio ad_array[i].pause(); // Pausa os anúncios exceto o último (de maior CTR) } } } }

  • @ecstasyrealm6803
    @ecstasyrealm6803 ปีที่แล้ว

    Can you share the whole code please?

  • @mehrosenasir9974
    @mehrosenasir9974 ปีที่แล้ว

    I've linked my Bigquery project to my GA4 but I only see pseduonymous_users table and not the events table. Any tip, please?

  • @joshaverbeck5691
    @joshaverbeck5691 ปีที่แล้ว

    your source code on your github contains a config.json file. I don't recall that being mentioned in the video but it is necessary for __init__.py to work. Where did that file come from and what should be specified in it?

  • @BerkahAhmadBersaudara
    @BerkahAhmadBersaudara ปีที่แล้ว

    Ca: MutateError.UNSPECIFIED: Specified version 'v10' not supported. at getReportRowForDuring (Code:337:24) at getReportRowForDate (Code:326:10) at main (Code:91:17) please help me

  • @roguephilosopher2465
    @roguephilosopher2465 ปีที่แล้ว

    Hey there! There was an update from Universal Analytics to G4 Google Analytics, is there a resource that you could point to that would help with connecting to their API?

  • @nuraysahabbas9660
    @nuraysahabbas9660 ปีที่แล้ว

    Hi, thank u so much for your video. I am searching for google ads script lately and found your video, which so amazing. I have one question, is it possible to set the schedule google ads script so it is running every second to check the campaign performance? ^^

  • @Sergio-td7mn
    @Sergio-td7mn ปีที่แล้ว

    really good examples. Also great that you stick to same examples throughout the series

  • @Sergio-td7mn
    @Sergio-td7mn ปีที่แล้ว

    thank you a lot!

  • @kunikasingla2326
    @kunikasingla2326 ปีที่แล้ว

    Hi, Can you please help what session source in GA4 is equivalent to what source in bigquery?

  • @shreyabanker8076
    @shreyabanker8076 ปีที่แล้ว

    Is it possible to grab "Session Google Ads campaign_name" from table or its different from "Google Ads campaign_name" , I am confused as in GA4 reports it's shows "Session Google Ads campaign_name " , How we can grab google ad data at session level?

  • @JayMurphyOnlineMarketer
    @JayMurphyOnlineMarketer ปีที่แล้ว

    Fantastic series Roman - thank you for putting together this great tutorial series! The conversion tracking works like a charm - we have event_name = generate_lead. Quick question, I am trying to add a landing page field to the session table by using this - FIRST_VALUE(page_location) OVER (PARTITION BY ga_session_id ORDER BY event_ts) AS lp_page_location. Selecting from the event_aggregated table. But getting this error - "Syntax error: Expected end of input but got identifier "event_aggregated" at [1:1]". what will fix this.

  • @nicolasvargas6846
    @nicolasvargas6846 ปีที่แล้ว

    thank you man, you're a hero!!!

  • @nikhilnagar3510
    @nikhilnagar3510 ปีที่แล้ว

    Hi, this is a nice series, I have one query: Do you think BigQuery is helpful to fetch UA property data to GA4 property? In UA analytics, we had old data, so can we import all history to the new GA4 property?

  • @GoDevAccount
    @GoDevAccount ปีที่แล้ว

    Thanks for sharing this info. Super practical and helpful.

  • @SerhiiYashchuk
    @SerhiiYashchuk ปีที่แล้ว

    thanks, veryuseful tips)

  • @BHOOMIKAKAPOOR-l4p
    @BHOOMIKAKAPOOR-l4p ปีที่แล้ว

    Hey, I have a table and I have events in that. I am trying to connect them to my PowerBI from Big query and somehow it is not popping up in my PowerBI, Do you have any idea why ?

  • @ultra_legend23
    @ultra_legend23 ปีที่แล้ว

    Hi Thanks so much. Is there any way to backfill the GA4 data in Big query? I need to backfill the raw data that is exported everyday into big query. Thanks

  • @BeatriceLeblanc-w4j
    @BeatriceLeblanc-w4j ปีที่แล้ว

    Unfortunately this add on does not work anymore, do you have any other alternative ?

  • @gikis1
    @gikis1 ปีที่แล้ว

    Hi Roman, that's an awesome playlist, thank you! For some reason I get totally different event count in GA4 vs following your query. Not sure what exactly is going on here - I have tried multiple ways to count events, but the disparity to Google Analytics 4 interface in the default unsampled report remains huge :( Is there any advice you can share please? Thank you!

  • @aloisiolemos5022
    @aloisiolemos5022 ปีที่แล้ว

    This content is amazing! Tks guy!

  • @gbemikeolowe8111
    @gbemikeolowe8111 ปีที่แล้ว

    I've been trying to create custom queries from the google_ads data that schedule daily and append to a table. Was also wondering if the table could be exported to a google sheet where each appended data/update reflects in the google sheet.

  • @YoginiYadav-z4g
    @YoginiYadav-z4g ปีที่แล้ว

    in UA we do have hits.number schema the same i want it for GA4..?

  • @x_o_x_o
    @x_o_x_o ปีที่แล้ว

    I love these videos, its exactly what I needed!

  • @ivo950028
    @ivo950028 ปีที่แล้ว

    Роман, Огромное Спасибо за интересную и профессиональную информацию! Такую информацию, действительно, очень сложно найти.

  • @JosePla
    @JosePla ปีที่แล้ว

    Great, you saved my day, this video is like a summary of 20 websites I had to look through

  • @deepakrawat5103
    @deepakrawat5103 ปีที่แล้ว

    Hi Marketing Watch House, I am trying to find keyword performance for my campaigns. Since I do not have a Google Ads account, I created an empty one to transfer these tables and then create fake data to recreate the tables. I am not sure what field do I need to use to find out the keyword performance (let's say revenue or clicks) for a specific campaign. Any help would be appreciated.

  • @EthanLaithwaite-ci9jo
    @EthanLaithwaite-ci9jo ปีที่แล้ว

    Awesome Video!!

  • @LatinoWebStudio
    @LatinoWebStudio ปีที่แล้ว

    Thanks for the video! Do you have any recommendations on how to use Python for lead generation? That aren’t as complicated as the Google ads API

  • @EthanLaithwaite-ci9jo
    @EthanLaithwaite-ci9jo ปีที่แล้ว

    I am a bit confused on how you created a new col called ga_session_id that basically duplicated the session ids? Sorry if this question sounds stupid