AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
1.9K members online now
1.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google Analytics API Start-date and End-date

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi

 

I am trying to get some data from the Google Analytics API. The start-date I want is start of this month and end-date should be "today". I am not being able to figure out how I can choose "thismonth" as start-date. What should I write as start-date?

1 Expert replyverified_user

Re: Google Analytics API Start-date and End-date

Top Contributor
# 2
Top Contributor
Hi Awais - for this case you would explicitly have to define the start-date using a function which would return the date of the current month first date in YYYY-MM-DD format.

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Google Analytics API Start-date and End-date

Explorer ✭ ✭ ✭
# 3
Explorer ✭ ✭ ✭
Hi Awais,

In Google sheets the formula is:

Return this month day 1 : =eomonth(today(),-1)+1
Return last day of current month: =eomonth(today(), 0)
Return today: =today()
Return yesterday: =today()-1

https://support.google.com/docs/table/25273?hl=en