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.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 303 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 104 SQL DataFlows
- 640 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 769 Beast Mode
- 72 App Studio
- 43 Variables
- 718 Automate
- 185 Apps
- 462 APIs & Domo Developer
- 57 Workflows
- 14 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 402 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 9 Software Integrations
- 135 Manage
- 132 Governance & Security
- 8 Domo Community Gallery
- 44 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive