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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive