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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive