Google Ads Automation with Python - Getting Report in Pandas and Excel

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody my name is roman and it's marketing watch house and thank you so much for staying with me for google ads plus python automation tutorial so the last time we talked about the goggle and how it works and gekko is a new version of language that is used to query reports from google ads and with goggle you basically can get almost any dimension almost any information almost everything thing you need to remember that as in google ads you cannot get for example some regional or geographic report combined with some device reports a lot of other very detailed information cannot be combined together the same is going to happen here not everything can be combined together and this is done so to restrict the access to certain private information so you cannot get very detailed information you actually cannot get more detail that you can get it in interface but again for majority of automation majority of stuff is good what's gonna what you gonna build you don't necessarily need that information so what we're gonna do today we're gonna build our reporting stuff that is gonna get some information from the internet and save it in a pandas which is the most nicest thing to fit to handle it i will remind you that i'm not a developer i'm not a professional developer this is something i do for fun for my hobbies for my work as well but um i do small ad hocs most of the time so my solution is not going to be the most optimized solution it's just going to make sense it's going to work and it's going to work fast enough that's what i care about so first of all what i'm going to do i'm going to just modify this script to get the information i want to do that i will go and copy paste the current code because why why fix something that is ain't broken right so here is my new copy so i need to change the name new reporting tool and here is new reporting tool this is my file second thing i'm gonna do i'm gonna go line by line and change something for example this is not gonna change this is the ga service i'm still going to use the same google ad service in most of my scripts the last time we compiled the query and i'm going to use this query for those of you who haven't been with us in the last video so what you need to do you need to go to gogglebuilder unless of course you know it by hard and to do that you just go goggle generator and that will lead you to official interactive google ads query builder which will allow you to build whatever report you want to have so the last time we built the campaign level report that contains campaign name campaign url tracking template clicks impressions and campaign id i'm going to copy this and paste it here let's do some intent and then what i'm going to change i want to have campaign id all i have when i have campaign id before campaign name campaign id you know what i also want to have i want to have dates this is actually important let's have date let's have segment date paste it here so it's going to be segments date okay i can copy this and just paste here this should be enough so this represents the report i'm gonna get let's do the next step and see what's gonna happen so this should get me the information for this customer id and if i do everything correctly and i just do print response and let's say return we should get data straight away it's gonna be ugly but it should be there okay the invalid is from it's because i have a comma which i should get rid of let's run it again and the data is there it just it just you just cannot look at this which is great let's let's go on so i'm not going to use the keyword match type because i don't request anything on the keyword level at all so i get rid of that and then again as i described last time we have the big package from amazon inside there are several smaller packages which have patches and inside the batches there are excel files that contain rows so i'm going to work with rows so i will just get rid of everything here and i will say that okay for example date equals row dot and then i can just copy this segment date and then i can say for example campaign name campaign name dot name or campaign name equals row dot company so let's just print these two things so it's gonna be date and then campaign name and let's see what's going to happen oh it's going to break because this should also go away let's run it let's run it let's see what's going to happen it is a lot of campaign names they're all incurring but doesn't matter you could i mean you can support any language uh let's just move forward and what we're gonna do now we wanted to we wanted to get this data in pandas and for those who don't know pandas is the incredibly powerful thing inside the python that allows you to handle arrays of data and to do so i'm going to create the array which is going to be all data and it's going to just contain all of the stuff and each element of this array is going to be the information about the row and here i'm going to say single row equals dictionary and then i'm gonna say here single row by the way the naming is disgusting don't don't do this um single row of campaign name equals row dot campaign dot name then i'm gonna just copy paste this for every single field i have there which is going to be let's first have date and it's going to be segments date and then you're going to have com pain id it's gonna be id then we have tracking template tracking template copy paste here and two more things it's gonna be clicks and row matrix clicks and here's going to be impressions so as you can see here in on the left side you can call it whatever you want you can call it for example my favorite impressions it doesn't matter uh and on the right side you need to use the same name you used in the guckel impressions who came up with this with this name anyway um let's print what we have here so we're gonna print single row and we're gonna launch it hopefully it should give us uh okay you cannot do this because this is not the name it's date okay hopefully it's going to work from the first try but it didn't anyway here it is we have lots and lots of arrays containing a lot of information so now the cool part if we put all of these dictionaries in one array and then give it to pandas it will automatically convert it to data frame so we don't need to do anything except we need to say import pandas as pd by the way if you don't know you can have here go to requirements but pandas should already be there but if you put their pandas you will have something like here install requirements uh if you don't have it then the second thing what we need to do instead of printing it let's say all data dot append and then let's say single row and after the whole try accept thing here we're gonna say data frame equals pd data frame and then let's do what was the name of this all data and then we're gonna print df.head of five which should give us first five rows if everything works of course here it is and if i do df dot to for example csv and then i give something like mydata.csv and launch it the data everything i have in that report is going to be saved in this csv which you can later load to your excel and if you have any automation based on this you don't necessarily need to go to google ads to download any report you can basically download any report with one button on your python and just work with it this is way faster than working with user interface so if you freelancer in-house or agency and you still go and download all the manual reporting and you don't use bigquery this one can can bring you millions it's just just fantastic tool and also another thing you can use you can say to excel and you need to define for example my data then i need to define it's going to be xls or xlx6 so it's going to be this and then it will break because you don't have by default you don't have a package to do that so when i am going to do this it will say i need to have open pixel so i copy this i go to my requirements paste it here push install it will take some time you can see it on the bottom right to install the package so we're going to wait for it and it hopefully will not break but i mean this phrase is just working for everything in programming it was successfully installed if i remember correctly it should break again with another problem with another package let's check so it's scanning and compiling and running and here is my excel file with the correct um everything i mean with correct encoding with something you can send to your client you can play around with it you can do a lot of stuff with it and i fi when i first found this i just like wow i don't know why google ads still restricts access to api so heavily where this actually can save a lot of money and time so my computer right now using a lot of ventilation so you might hear some noise but here's my campaign name campaign id per day so i can check when what was the tracking template per day i have clicks and impressions and everything i can have and i can need so i encourage you to go there and to build the reporting that you want to check you go there build something for keywords download the keywords that have low click-through rate or have low impressions anyway subscribe to this channel put like leave your comments below if you need any any help support if you have any questions when you have any projects you want to me work on link write me in linkedin write me on the private message or leave me comments below [Music] you
Info
Channel: Marketing Watch House
Views: 6,546
Rating: undefined out of 5
Keywords: google ads api, google adwords api, google ads python, google ads token, google ads automation, google ads tutorial, google ads lib, google ads yaml, yaml api file, google ads developer token, google ads client id, google ads client secret, google ads refresh token, adwords reports, google ads api reports, google ads api python, google ads api python tutorial, google ads api setup, google ads api discovery campaigns, google adwords api tutorial
Id: oe6t4l6NVDE
Channel Id: undefined
Length: 12min 16sec (736 seconds)
Published: Sat Jan 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.