def create_custom_events()

in python/ga4_setup/setup.py [0:0]


def create_custom_events(configuration: map):
  """
  Creates custom events in Google Analytics 4 based on the event names defined in the activation type configuration template file.

  Args:
    configuration: A dictionary containing the Google Analytics 4 property ID and data stream ID.

  Raises:
    GoogleAnalyticsAdminError: If an error occurs while creating the custom events.
  """
  event_names = load_event_names()
  existing_event_names = load_existing_ga4_custom_events(configuration)
  for event_name in event_names:
    if not event_name in existing_event_names:
      print(f"Create custom event with name: {event_name}")
      create_custom_event(configuration, event_name)