Google Ads API - Which metrics can I use to get the number of clicks of a Campaign per day - google-ads-api

I am looking for a way to get number of clicks per day between START_DATE and END_DATE. The documentation for Google ADS v10 is huge and so far I'm unable to get clicks per day.
NOTE: I'm able to get total number of clicks BETWEEN DATES but I need clicks / day. Could anyone help.

What you are looking for is segments.date in your select clause. I would expect your query to look something like this.
SELECT
campagin.name
, metrics.clicks
, segments.date
FROM campaign
WHERE
segments.date >= '2022-06-01'
This link is the google query builder helper and it will probably help you out if you get stuck.
https://developers.google.com/google-ads/api/fields/v11/campaign_query_builder

Related

Google Finance does not show last closing price after market hours. It just shows last *traded* price instead of *closing*

My query is on stock market of India where I fetch the quotes from =googlefinance function in my google sheet. I was very disappointed to know that the function does not show last closing price. Instead, it shows the last traded price.
Lets take an example of a stock RELIANCE:
=GoogleFinance("NSE:reliance", "price") result is 2498.00 which is incorrect.
Actual closing on Friday, 16 Sep 2022 was 2499.20 as per official National Stock Exchange of India. You may refer to this link for the Close price and the screenshot below
The incorrect quote 2498.00 is the last traded price before market closing
The correct quote is 2499.20 when the markets were closed.
This behavior is common across all stocks of Indian stock market. I have used almost all the parameters those are available in the =googlefinance function but I could not find a way to get the correct stock quote.
Then I decided to scrape the value from the official website using the following without success
<div id="closePrice">2,499.20</div>
//*[#id="closePrice"]
/html/body/div[2]/div[4]/div[2]/div[1]/div[4]/ul/li[6]/div[1]
document.querySelector("#closePrice")
I searched a lot of valuable articles on this site and also on google but could not find a solution which would fetch the desired result. Can someone help me with a way to get 2499.20 as a result for RELIANCE stock either using =googlefinance function or by scraping the value from office website?
Thank you.
Solution suggested by #TheMaster (Thank you so much!)
=LAMBDA(gf,INDEX(gf,ROWS(gf),2))(GOOGLEFINANCE("NSE:RELIANCE", "close",TODAY()-5,15))
Two other ways
=index(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),4,2)
=query(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),"select Col2 where Col1 < date '"&TEXT(today()+1, "YYYY-MM-DD")&"' order by Col1 desc limit 1",False)
I am also keen to know which one of these or other methods (if any) will get the results faster without crashes or any other processing issues as my googlesheet is loaded with thousands of stock quotes which will be refreshed every 1 minute.
Only historical prices support close attribute. Use the start date argument to get historical prices and get the last close:
=LAMBDA(gf,INDEX(gf,ROWS(gf),2))(GOOGLEFINANCE("NSE:RELIANCE", "close",TODAY()-5,15))
This is another way of achieving the result.
=query(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),"select Col2 where Col1 < date '"&TEXT(today()+1, "YYYY-MM-DD")&"' order by Col1 desc limit 1",False)
When I compared performance of both the solutions =LAMBDA and =QUERY on 2500+ stocks, I found query to be more faster than lambda.
Cheers!
However, my main query remains unresolved as no formula of google finance gives today's close until the actual day is over.

How to get the Twitter follower count of a user on a given date, or at the time of a tweet?

I have access to Twitter API for Academic Research, and I'd like to get the follower count on a given date of a user, or at the time of a tweet.
The doc mentions that "This fields parameter enables you to select which specific user fields will deliver in each returned Tweet.", so I assumed that by adding public_metrics to the users.field, the number of followers can be seen in each returned Tweet, however, in each returned Tweet, I can only see user_id. https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference.
Is it even possible to achieve what I want with Twitter API for Academic Research? Is there any other approach to make it?
Thank you so much.
You cannot get the follower count on a specific date; it will always be the count at the time you make the API call.
You may need to add expansions to your API call in order to receive the values you are trying to pull out.

How do I get the nearest past date in a range for each entry in another list?

I collect customer feedback for my education business and add it to a Google Sheet. The feedback data has a submission date (A2:A) and some satisfaction metrics, which I visualize in a Google Data Studio dashboard.
The problem is that I want the feedback per cohort, but not everyone fills in the feedback form on the same day. I have a list of all courses with their respective dates (Cohorts!A2:A), and I want to assign each feedback submission to their respective cohort in a new column. It would be nice to also match it to the specific course type and country, but for now matching the cohort date would suffice.
I've tried using VLOOKUP and ARRAYFORMULA to go through the feedback dates and get the nearest past date to take it as the "course date" for that student. All the solutions I've tried either only take a single date or TODAY as a reference, but I have a whole list I'd like to fill in.
From my understanding, you are trying to round the timestamp, then match it to your course table?
To round a timestamp to a date:
=INT($A2)
When doing lookups like you're describing, I frequently end up calculating the nearest week as well - this formula returns the Sunday of the week start. Figured it might be helpful.
=text($A2+CHOOSE(WEEKDAY($A2),0,-1,-2,-3,-4,-5,-6),"m/d/yyyy")

Google sheets sum if within specific week

I have a Google Sheets budget and I am trying to write something to keep track of how much money I have spent in a specific week.
Link to my example budget below.
https://docs.google.com/spreadsheets/d/15HP24iDd-kZ-MydKwgbMCoG0rCHN_DNOcBZsm0HhKQ0/edit?usp=sharing
I am already using sumif() to say, if the entry's CATEGORY says "Gas" then add theAMOUNT to the Gas row in the table. I want to add another parameter that will sum the amounts if the entry's CATEGORY says Gas AND is within the specified week above the table...(WEEK 31).
I hope this makes sense if you need more clarification I will try my best to do so.
As Diego suggested, SUMIFS()should work. Example
=sumifs($C$4:$C$9, $D$4:$D$9, "=week "&$I$3, $B$4:$B$9,$F4)
An alternative would be to use sumproduct().
=sumproduct($D$4:$D$9="week "&$I$3, $B$4:$B$9=$F4, $C$4:$C$9)
You should be able to fill down this formula (as far as needed) for the other categories.

YQL Fantasy Hockey - League Standings by Month?

I'm trying to gather league standings by month (or a custom time period)
I know how to do it for a specific date but can't seem to find a way to do from x to y
Is this possible? (other than repeating the query for each day I want)
Is is not a head to head or rotisserie league, just straight overall points.
Edit:
Example query:
No, there is no way to fetch by month or for a date range. If you look at the YQL table fantasysports.leagues.scoreboard, you can see the parameters only accept the optional week parameter. This matches the Yahoo! Fantasy Sports API docs (search for 'scoreboard') which shows it can give results for the current week, or another specified week.
I think this is because the Yahoo! Fantasy Sports scoreboards are all week-based, regardless of the actual frequency of games for the specific sport.
To capture scores by month, you can make several individual calls for each week.

Resources