MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / get_events_for_organisation

Function get_events_for_organisation

api/app_analytics/query.py:25–46  ·  view source on GitHub ↗

Get number of tracked events for last 30 days for an organisation :return: number of events as integer

(organisation)

Source from the content-addressed store, hash-verified

23
24
25def 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"])

Callers

nothing calls this directly

Calls 4

get_serviceFunction · 0.85
get_unique_slugMethod · 0.80
executeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…