def get_events_for_organisation(organisation):  # type: ignore[no-untyped-def]
    """
    Get number of tracked events for last 30 days for an organisation

    :return: number of events as integer
    """
    ga_response = (
        get_service()  # type: ignore[no-untyped-call]
        .data()
        .ga()
        .get(
            ids=settings.GA_TABLE_ID,
            start_date="30daysAgo",
            end_date="today",
            metrics="ga:totalEvents",
            dimensions="ga:date",
            filters=f"ga:eventCategory=={organisation.get_unique_slug()}",
        )
        .execute()
    )

    return int(ga_response["totalsForAllResults"]["ga:totalEvents"])

    Get number of tracked events for last 30 days for an organisation

    :return: number of events as integer
    
api/app_analytics/query.py