Get number of tracked events for last 30 days for an organisation :return: number of events as integer
(organisation)
| 23 | |
| 24 | |
| 25 | def get_events_for_organisation(organisation): # type: ignore[no-untyped-def] |
| 26 | """ |
| 27 | Get number of tracked events for last 30 days for an organisation |
| 28 | |
| 29 | :return: number of events as integer |
| 30 | """ |
| 31 | ga_response = ( |
| 32 | get_service() # type: ignore[no-untyped-call] |
| 33 | .data() |
| 34 | .ga() |
| 35 | .get( |
| 36 | ids=settings.GA_TABLE_ID, |
| 37 | start_date="30daysAgo", |
| 38 | end_date="today", |
| 39 | metrics="ga:totalEvents", |
| 40 | dimensions="ga:date", |
| 41 | filters=f"ga:eventCategory=={organisation.get_unique_slug()}", |
| 42 | ) |
| 43 | .execute() |
| 44 | ) |
| 45 | |
| 46 | return int(ga_response["totalsForAllResults"]["ga:totalEvents"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…