in python/ga4_setup/setup.py [0:0]
def create_custom_dimensions_for(use_case: str, fields: List[str], existing_dimensions: List[str], configuration: map):
"""
Creates custom dimensions in Google Analytics 4 based on the provided configuration for a specific use case.
Args:
use_case: The use case for which the custom dimensions are being created.
fields: A list of field names to be used as custom dimensions.
existing_dimensions: A list of existing custom dimension names.
configuration: A dictionary containing the Google Analytics 4 property ID and data stream ID.
Raises:
GoogleAnalyticsAdminError: If an error occurs while creating the custom dimensions.
"""
for field in fields:
display_name = f'MAJ {use_case} {field}'
if not display_name in existing_dimensions:
print(f'Create custom dimension: {display_name}')
create_custom_dimension(configuration, field, display_name)