def load_existing_ga4_custom_dimensions()

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


def load_existing_ga4_custom_dimensions(configuration: map):
  """
  Loads the existing custom dimension objects from Google Analytics 4 based on the provided configuration.

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

  Returns:
    A list of existing custom dimension names.

  Raises:
    GoogleAnalyticsAdminError: If an error occurs while retrieving the custom dimensions.
  """
  page_result = load_existing_ga4_custom_dimension_objs(configuration)
  existing_custom_dimensions = []
  for page in page_result.pages:
    for custom_dimension in page.custom_dimensions:
      existing_custom_dimensions.append(custom_dimension.display_name)
  return existing_custom_dimensions