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
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 603 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 697 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 388 Distribute
- 111 Domo Everywhere
- 271 Scheduled Reports
- 6 Software Integrations
- 113 Manage
- 110 Governance & Security
- 9 Domo University
- 30 Product Releases
- Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive