Filtering Google Analytics API to "start of month" through "today"

All,
We create monthly KPIs based on GA data that I am trying to recreate in Domo. I would like to filter the connector to run based on a relative date range including the start of the month to today. E.g. running the report today would pull in data from 9/1 to 9/18. Running on Oct. 1 would pull data from 10/1 to 10/1.
Is there a way to modify the script below to handle this?
--{
"dimensionFilterClauses": [
{
"filters": [
{
"dimensionName": "ga:country",
"operator": "EXACT",
"expressions": [
"United States"
]
}
]
}
]
--}
Comments
-
Hey @dale_anderson,
I did a bit of digging, and found that (in the Domo connector at least) the parameters start_date and end_date determine the data range for the API. These can be set to specific offset values, such as "today" or "today-5" (today less 5 days). Code below with some relevant parameters bolded. According to this, GA supports "startofmonth" relative date value, so you could try setting start_date to "startofmonth" and end_date to "today" and see where that gets you. Hope this is helpful!
{"backfill":"","report":"Base Metrics","retry.retryNumber":"0","start_date":"Today-4","level":"all","end_date":"Today","timezone":"US/Mountain","profile":"<profile number>","updatemode.mode":"Append","accountId":"<Account ID number>","schedule":{"type":"MANUAL","timezone":"UTC"},"updatemode":{"mode":"APPEND","upsertKeys":""}}
Edit: It doesn't look as though GA supports the "startofmonth" relative date. You can do ndaysago or a today offset, but start of month doesn't seem to work. Probably adjust logic to do a rolling 15 or 30 days? Just a thought.
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 655 Datasets
- 114 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 409 Distribute
- 120 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive