As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

AnalyticsAdminService

class google.analytics.admin_v1beta.services.analytics_admin_service.AnalyticsAdminServiceAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Union[str, google.analytics.admin_v1beta.services.analytics_admin_service.transports.base.AnalyticsAdminServiceTransport] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]

Service Interface for the Analytics Admin API (GA4).

Instantiates the analytics admin service async client.

Parameters
  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

  • transport (Union[str, AnalyticsAdminServiceTransport]) – The transport to use. If set to None, a transport is chosen automatically.

  • client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –

    Custom options for the client.

    1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).

    2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.

    3. The universe_domain property can be used to override the default “googleapis.com” universe. Note that api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

Raises

google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.

static account_path(account: str) str

Returns a fully-qualified account string.

static account_summary_path(account_summary: str) str

Returns a fully-qualified account_summary string.

async acknowledge_user_data_collection(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.AcknowledgeUserDataCollectionRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.analytics_admin.AcknowledgeUserDataCollectionResponse[source]

Acknowledges the terms of user data collection for the specified property. This acknowledgement must be completed (either in the Google Analytics UI or through this API) before MeasurementProtocolSecret resources may be created.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_acknowledge_user_data_collection():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.AcknowledgeUserDataCollectionRequest(
        property="property_value",
        acknowledgement="acknowledgement_value",
    )

    # Make the request
    response = await client.acknowledge_user_data_collection(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.AcknowledgeUserDataCollectionRequest, dict]]) – The request object. Request message for AcknowledgeUserDataCollection RPC.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for AcknowledgeUserDataCollection RPC.

Return type

google.analytics.admin_v1beta.types.AcknowledgeUserDataCollectionResponse

property api_endpoint

Return the API endpoint used by the client instance.

Returns

The API endpoint used by the client instance.

Return type

str

async archive_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ArchiveCustomDimensionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Archives a CustomDimension on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_archive_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ArchiveCustomDimensionRequest(
        name="name_value",
    )

    # Make the request
    await client.archive_custom_dimension(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ArchiveCustomDimensionRequest, dict]]) – The request object. Request message for ArchiveCustomDimension RPC.

  • name (str) –

    Required. The name of the CustomDimension to archive. Example format: properties/1234/customDimensions/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async archive_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ArchiveCustomMetricRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Archives a CustomMetric on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_archive_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ArchiveCustomMetricRequest(
        name="name_value",
    )

    # Make the request
    await client.archive_custom_metric(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ArchiveCustomMetricRequest, dict]]) – The request object. Request message for ArchiveCustomMetric RPC.

  • name (str) –

    Required. The name of the CustomMetric to archive. Example format: properties/1234/customMetrics/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

static common_billing_account_path(billing_account: str) str

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str

Returns a fully-qualified location string.

static common_organization_path(organization: str) str

Returns a fully-qualified organization string.

static common_project_path(project: str) str

Returns a fully-qualified project string.

static conversion_event_path(property: str, conversion_event: str) str

Returns a fully-qualified conversion_event string.

async create_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateConversionEventRequest, dict]] = None, *, parent: Optional[str] = None, conversion_event: Optional[google.analytics.admin_v1beta.types.resources.ConversionEvent] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.ConversionEvent[source]

Creates a conversion event with the specified attributes.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.CreateConversionEventRequest(
        parent="parent_value",
    )

    # Make the request
    response = await client.create_conversion_event(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateConversionEventRequest, dict]]) – The request object. Request message for CreateConversionEvent RPC

  • parent (str) –

    Required. The resource name of the parent property where this conversion event will be created. Format: properties/123

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • conversion_event (google.analytics.admin_v1beta.types.ConversionEvent) –

    Required. The conversion event to create.

    This corresponds to the conversion_event field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A conversion event in a Google Analytics property.

Return type

google.analytics.admin_v1beta.types.ConversionEvent

async create_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateCustomDimensionRequest, dict]] = None, *, parent: Optional[str] = None, custom_dimension: Optional[google.analytics.admin_v1beta.types.resources.CustomDimension] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomDimension[source]

Creates a CustomDimension.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    custom_dimension = admin_v1beta.CustomDimension()
    custom_dimension.parameter_name = "parameter_name_value"
    custom_dimension.display_name = "display_name_value"
    custom_dimension.scope = "ITEM"

    request = admin_v1beta.CreateCustomDimensionRequest(
        parent="parent_value",
        custom_dimension=custom_dimension,
    )

    # Make the request
    response = await client.create_custom_dimension(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateCustomDimensionRequest, dict]]) – The request object. Request message for CreateCustomDimension RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • custom_dimension (google.analytics.admin_v1beta.types.CustomDimension) –

    Required. The CustomDimension to create.

    This corresponds to the custom_dimension field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a CustomDimension.

Return type

google.analytics.admin_v1beta.types.CustomDimension

async create_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateCustomMetricRequest, dict]] = None, *, parent: Optional[str] = None, custom_metric: Optional[google.analytics.admin_v1beta.types.resources.CustomMetric] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomMetric[source]

Creates a CustomMetric.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    custom_metric = admin_v1beta.CustomMetric()
    custom_metric.parameter_name = "parameter_name_value"
    custom_metric.display_name = "display_name_value"
    custom_metric.measurement_unit = "HOURS"
    custom_metric.scope = "EVENT"

    request = admin_v1beta.CreateCustomMetricRequest(
        parent="parent_value",
        custom_metric=custom_metric,
    )

    # Make the request
    response = await client.create_custom_metric(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateCustomMetricRequest, dict]]) – The request object. Request message for CreateCustomMetric RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • custom_metric (google.analytics.admin_v1beta.types.CustomMetric) – Required. The CustomMetric to create. This corresponds to the custom_metric field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a custom metric.

Return type

google.analytics.admin_v1beta.types.CustomMetric

async create_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateDataStreamRequest, dict]] = None, *, parent: Optional[str] = None, data_stream: Optional[google.analytics.admin_v1beta.types.resources.DataStream] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataStream[source]

Creates a DataStream.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    data_stream = admin_v1beta.DataStream()
    data_stream.type_ = "IOS_APP_DATA_STREAM"

    request = admin_v1beta.CreateDataStreamRequest(
        parent="parent_value",
        data_stream=data_stream,
    )

    # Make the request
    response = await client.create_data_stream(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateDataStreamRequest, dict]]) – The request object. Request message for CreateDataStream RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • data_stream (google.analytics.admin_v1beta.types.DataStream) – Required. The DataStream to create. This corresponds to the data_stream field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a data stream.

Return type

google.analytics.admin_v1beta.types.DataStream

Creates a FirebaseLink.

Properties can have at most one FirebaseLink.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_firebase_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.CreateFirebaseLinkRequest(
        parent="parent_value",
    )

    # Make the request
    response = await client.create_firebase_link(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateFirebaseLinkRequest, dict]]) – The request object. Request message for CreateFirebaseLink RPC

  • parent (str) –

    Required. Format: properties/{property_id} Example: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • firebase_link (google.analytics.admin_v1beta.types.FirebaseLink) –

    Required. The Firebase link to create.

    This corresponds to the firebase_link field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A link between a GA4 property and a Firebase project.

Return type

google.analytics.admin_v1beta.types.FirebaseLink

Creates a GoogleAdsLink.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_google_ads_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.CreateGoogleAdsLinkRequest(
        parent="parent_value",
    )

    # Make the request
    response = await client.create_google_ads_link(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateGoogleAdsLinkRequest, dict]]) – The request object. Request message for CreateGoogleAdsLink RPC

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • google_ads_link (google.analytics.admin_v1beta.types.GoogleAdsLink) –

    Required. The GoogleAdsLink to create.

    This corresponds to the google_ads_link field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A link between a GA4 property and a Google Ads account.

Return type

google.analytics.admin_v1beta.types.GoogleAdsLink

async create_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateMeasurementProtocolSecretRequest, dict]] = None, *, parent: Optional[str] = None, measurement_protocol_secret: Optional[google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret[source]

Creates a measurement protocol secret.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_measurement_protocol_secret():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    measurement_protocol_secret = admin_v1beta.MeasurementProtocolSecret()
    measurement_protocol_secret.display_name = "display_name_value"

    request = admin_v1beta.CreateMeasurementProtocolSecretRequest(
        parent="parent_value",
        measurement_protocol_secret=measurement_protocol_secret,
    )

    # Make the request
    response = await client.create_measurement_protocol_secret(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreateMeasurementProtocolSecretRequest, dict]]) – The request object. Request message for CreateMeasurementProtocolSecret RPC

  • parent (str) –

    Required. The parent resource where this secret will be created. Format: properties/{property}/dataStreams/{dataStream}

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • measurement_protocol_secret (google.analytics.admin_v1beta.types.MeasurementProtocolSecret) –

    Required. The measurement protocol secret to create.

    This corresponds to the measurement_protocol_secret field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A secret value used for sending hits to Measurement Protocol.

Return type

google.analytics.admin_v1beta.types.MeasurementProtocolSecret

async create_property(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreatePropertyRequest, dict]] = None, *, property: Optional[google.analytics.admin_v1beta.types.resources.Property] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Property[source]

Creates an “GA4” property with the specified location and attributes.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_create_property():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    property = admin_v1beta.Property()
    property.display_name = "display_name_value"
    property.time_zone = "time_zone_value"

    request = admin_v1beta.CreatePropertyRequest(
        property=property,
    )

    # Make the request
    response = await client.create_property(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.CreatePropertyRequest, dict]]) – The request object. Request message for CreateProperty RPC.

  • property (google.analytics.admin_v1beta.types.Property) –

    Required. The property to create. Note: the supplied property must specify its parent.

    This corresponds to the property field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics GA4 property.

Return type

google.analytics.admin_v1beta.types.Property

static custom_dimension_path(property: str, custom_dimension: str) str

Returns a fully-qualified custom_dimension string.

static custom_metric_path(property: str, custom_metric: str) str

Returns a fully-qualified custom_metric string.

static data_retention_settings_path(property: str) str

Returns a fully-qualified data_retention_settings string.

static data_sharing_settings_path(account: str) str

Returns a fully-qualified data_sharing_settings string.

static data_stream_path(property: str, data_stream: str) str

Returns a fully-qualified data_stream string.

async delete_account(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteAccountRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Marks target Account as soft-deleted (ie: “trashed”) and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI.

If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_account():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteAccountRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_account(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeleteAccountRequest, dict]]) – The request object. Request message for DeleteAccount RPC.

  • name (str) –

    Required. The name of the Account to soft-delete. Format: accounts/{account} Example: “accounts/100”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteConversionEventRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a conversion event in a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteConversionEventRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_conversion_event(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeleteConversionEventRequest, dict]]) – The request object. Request message for DeleteConversionEvent RPC

  • name (str) –

    Required. The resource name of the conversion event to delete. Format: properties/{property}/conversionEvents/{conversion_event} Example: “properties/123/conversionEvents/456”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteDataStreamRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a DataStream on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteDataStreamRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_data_stream(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeleteDataStreamRequest, dict]]) – The request object. Request message for DeleteDataStream RPC.

  • name (str) –

    Required. The name of the DataStream to delete. Example format: properties/1234/dataStreams/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Deletes a FirebaseLink on a property

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_firebase_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteFirebaseLinkRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_firebase_link(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeleteFirebaseLinkRequest, dict]]) – The request object. Request message for DeleteFirebaseLink RPC

  • name (str) –

    Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} Example: properties/1234/firebaseLinks/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Deletes a GoogleAdsLink on a property

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_google_ads_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteGoogleAdsLinkRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_google_ads_link(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeleteGoogleAdsLinkRequest, dict]]) – The request object. Request message for DeleteGoogleAdsLink RPC.

  • name (str) –

    Required. Example format: properties/1234/googleAdsLinks/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteMeasurementProtocolSecretRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes target MeasurementProtocolSecret.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_measurement_protocol_secret():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteMeasurementProtocolSecretRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_measurement_protocol_secret(request=request)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeleteMeasurementProtocolSecretRequest, dict]]) – The request object. Request message for DeleteMeasurementProtocolSecret RPC

  • name (str) –

    Required. The name of the MeasurementProtocolSecret to delete. Format:

    properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_property(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeletePropertyRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Property[source]

Marks target Property as soft-deleted (ie: “trashed”) and returns it. This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI.

If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found, or is not a GA4 Property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_delete_property():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeletePropertyRequest(
        name="name_value",
    )

    # Make the request
    response = await client.delete_property(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.DeletePropertyRequest, dict]]) – The request object. Request message for DeleteProperty RPC.

  • name (str) –

    Required. The name of the Property to soft-delete. Format: properties/{property_id} Example: “properties/1000”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics GA4 property.

Return type

google.analytics.admin_v1beta.types.Property

Returns a fully-qualified firebase_link string.

classmethod from_service_account_file(filename: str, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

AnalyticsAdminServiceAsyncClient

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

AnalyticsAdminServiceAsyncClient

classmethod from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

AnalyticsAdminServiceAsyncClient

async get_account(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetAccountRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Account[source]

Lookup for a single Account.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_account():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetAccountRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_account(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetAccountRequest, dict]]) – The request object. Request message for GetAccount RPC.

  • name (str) –

    Required. The name of the account to lookup. Format: accounts/{account} Example: “accounts/100”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics account.

Return type

google.analytics.admin_v1beta.types.Account

async get_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetConversionEventRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.ConversionEvent[source]

Retrieve a single conversion event.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetConversionEventRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_conversion_event(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetConversionEventRequest, dict]]) – The request object. Request message for GetConversionEvent RPC

  • name (str) –

    Required. The resource name of the conversion event to retrieve. Format: properties/{property}/conversionEvents/{conversion_event} Example: “properties/123/conversionEvents/456”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A conversion event in a Google Analytics property.

Return type

google.analytics.admin_v1beta.types.ConversionEvent

async get_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetCustomDimensionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomDimension[source]

Lookup for a single CustomDimension.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetCustomDimensionRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_custom_dimension(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetCustomDimensionRequest, dict]]) – The request object. Request message for GetCustomDimension RPC.

  • name (str) –

    Required. The name of the CustomDimension to get. Example format: properties/1234/customDimensions/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a CustomDimension.

Return type

google.analytics.admin_v1beta.types.CustomDimension

async get_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetCustomMetricRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomMetric[source]

Lookup for a single CustomMetric.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetCustomMetricRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_custom_metric(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetCustomMetricRequest, dict]]) – The request object. Request message for GetCustomMetric RPC.

  • name (str) –

    Required. The name of the CustomMetric to get. Example format: properties/1234/customMetrics/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a custom metric.

Return type

google.analytics.admin_v1beta.types.CustomMetric

async get_data_retention_settings(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetDataRetentionSettingsRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataRetentionSettings[source]

Returns the singleton data retention settings for this property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_data_retention_settings():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetDataRetentionSettingsRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_data_retention_settings(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetDataRetentionSettingsRequest, dict]]) – The request object. Request message for GetDataRetentionSettings RPC.

  • name (str) –

    Required. The name of the settings to lookup. Format:

    properties/{property}/dataRetentionSettings Example: “properties/1000/dataRetentionSettings”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Settings values for data retention. This is a singleton resource.

Return type

google.analytics.admin_v1beta.types.DataRetentionSettings

async get_data_sharing_settings(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetDataSharingSettingsRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataSharingSettings[source]

Get data sharing settings on an account. Data sharing settings are singletons.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_data_sharing_settings():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetDataSharingSettingsRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_data_sharing_settings(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetDataSharingSettingsRequest, dict]]) – The request object. Request message for GetDataSharingSettings RPC.

  • name (str) –

    Required. The name of the settings to lookup. Format: accounts/{account}/dataSharingSettings Example: “accounts/1000/dataSharingSettings”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing data sharing settings of a Google Analytics account.

Return type

google.analytics.admin_v1beta.types.DataSharingSettings

async get_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetDataStreamRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataStream[source]

Lookup for a single DataStream.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetDataStreamRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_data_stream(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetDataStreamRequest, dict]]) – The request object. Request message for GetDataStream RPC.

  • name (str) –

    Required. The name of the DataStream to get. Example format: properties/1234/dataStreams/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a data stream.

Return type

google.analytics.admin_v1beta.types.DataStream

async get_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetMeasurementProtocolSecretRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret[source]

Lookup for a single “GA4” MeasurementProtocolSecret.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_measurement_protocol_secret():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetMeasurementProtocolSecretRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_measurement_protocol_secret(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetMeasurementProtocolSecretRequest, dict]]) – The request object. Request message for GetMeasurementProtocolSecret RPC.

  • name (str) –

    Required. The name of the measurement protocol secret to lookup. Format:

    properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A secret value used for sending hits to Measurement Protocol.

Return type

google.analytics.admin_v1beta.types.MeasurementProtocolSecret

classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]

Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameters

client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Returns

returns the API endpoint and the

client cert source to use.

Return type

Tuple[str, Callable[[], Tuple[bytes, bytes]]]

Raises

google.auth.exceptions.MutualTLSChannelError – If any errors happen.

async get_property(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetPropertyRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Property[source]

Lookup for a single “GA4” Property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_get_property():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetPropertyRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_property(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.GetPropertyRequest, dict]]) – The request object. Request message for GetProperty RPC.

  • name (str) –

    Required. The name of the property to lookup. Format: properties/{property_id} Example: “properties/1000”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics GA4 property.

Return type

google.analytics.admin_v1beta.types.Property

get_transport_class() Type[google.analytics.admin_v1beta.services.analytics_admin_service.transports.base.AnalyticsAdminServiceTransport]

Returns an appropriate transport class.

Parameters

label – The name of the desired transport. If none is provided, then the first transport in the registry is used.

Returns

The transport class to use.

Returns a fully-qualified google_ads_link string.

async list_account_summaries(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListAccountSummariesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListAccountSummariesAsyncPager[source]

Returns summaries of all accounts accessible by the caller.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_account_summaries():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListAccountSummariesRequest(
    )

    # Make the request
    page_result = client.list_account_summaries(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListAccountSummariesRequest, dict]]) – The request object. Request message for ListAccountSummaries RPC.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListAccountSummaries RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListAccountSummariesAsyncPager

async list_accounts(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListAccountsRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListAccountsAsyncPager[source]

Returns all accounts accessible by the caller.

Note that these accounts might not currently have GA4 properties. Soft-deleted (ie: “trashed”) accounts are excluded by default. Returns an empty list if no relevant accounts are found.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_accounts():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListAccountsRequest(
    )

    # Make the request
    page_result = client.list_accounts(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListAccountsRequest, dict]]) – The request object. Request message for ListAccounts RPC.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Request message for ListAccounts RPC.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListAccountsAsyncPager

async list_conversion_events(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListConversionEventsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListConversionEventsAsyncPager[source]

Returns a list of conversion events in the specified parent property. Returns an empty list if no conversion events are found.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_conversion_events():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListConversionEventsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_conversion_events(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListConversionEventsRequest, dict]]) – The request object. Request message for ListConversionEvents RPC

  • parent (str) –

    Required. The resource name of the parent property. Example: ‘properties/123’

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListConversionEvents RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListConversionEventsAsyncPager

async list_custom_dimensions(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListCustomDimensionsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager[source]

Lists CustomDimensions on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_custom_dimensions():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListCustomDimensionsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_custom_dimensions(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListCustomDimensionsRequest, dict]]) – The request object. Request message for ListCustomDimensions RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListCustomDimensions RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager

async list_custom_metrics(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListCustomMetricsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListCustomMetricsAsyncPager[source]

Lists CustomMetrics on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_custom_metrics():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListCustomMetricsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_custom_metrics(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListCustomMetricsRequest, dict]]) – The request object. Request message for ListCustomMetrics RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListCustomMetrics RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListCustomMetricsAsyncPager

async list_data_streams(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListDataStreamsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListDataStreamsAsyncPager[source]

Lists DataStreams on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_data_streams():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListDataStreamsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_data_streams(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListDataStreamsRequest, dict]]) – The request object. Request message for ListDataStreams RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListDataStreams RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListDataStreamsAsyncPager

Lists FirebaseLinks on a property. Properties can have at most one FirebaseLink.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_firebase_links():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListFirebaseLinksRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_firebase_links(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListFirebaseLinksRequest, dict]]) – The request object. Request message for ListFirebaseLinks RPC

  • parent (str) –

    Required. Format: properties/{property_id} Example: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListFirebaseLinks RPC Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListFirebaseLinksAsyncPager

Lists GoogleAdsLinks on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_google_ads_links():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListGoogleAdsLinksRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_google_ads_links(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListGoogleAdsLinksRequest, dict]]) – The request object. Request message for ListGoogleAdsLinks RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListGoogleAdsLinks RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListGoogleAdsLinksAsyncPager

async list_measurement_protocol_secrets(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListMeasurementProtocolSecretsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsAsyncPager[source]

Returns child MeasurementProtocolSecrets under the specified parent Property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_measurement_protocol_secrets():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListMeasurementProtocolSecretsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_measurement_protocol_secrets(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListMeasurementProtocolSecretsRequest, dict]]) – The request object. Request message for ListMeasurementProtocolSecret RPC

  • parent (str) –

    Required. The resource name of the parent stream. Format:

    properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListMeasurementProtocolSecret RPC Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsAsyncPager

async list_properties(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ListPropertiesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListPropertiesAsyncPager[source]

Returns child Properties under the specified parent Account. Only “GA4” properties will be returned. Properties will be excluded if the caller does not have access. Soft-deleted (ie: “trashed”) properties are excluded by default. Returns an empty list if no relevant properties are found.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_list_properties():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ListPropertiesRequest(
        filter="filter_value",
    )

    # Make the request
    page_result = client.list_properties(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ListPropertiesRequest, dict]]) – The request object. Request message for ListProperties RPC.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListProperties RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.ListPropertiesAsyncPager

static measurement_protocol_secret_path(property: str, data_stream: str, measurement_protocol_secret: str) str

Returns a fully-qualified measurement_protocol_secret string.

static parse_account_path(path: str) Dict[str, str]

Parses a account path into its component segments.

static parse_account_summary_path(path: str) Dict[str, str]

Parses a account_summary path into its component segments.

static parse_common_billing_account_path(path: str) Dict[str, str]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str]

Parse a project path into its component segments.

static parse_conversion_event_path(path: str) Dict[str, str]

Parses a conversion_event path into its component segments.

static parse_custom_dimension_path(path: str) Dict[str, str]

Parses a custom_dimension path into its component segments.

static parse_custom_metric_path(path: str) Dict[str, str]

Parses a custom_metric path into its component segments.

static parse_data_retention_settings_path(path: str) Dict[str, str]

Parses a data_retention_settings path into its component segments.

static parse_data_sharing_settings_path(path: str) Dict[str, str]

Parses a data_sharing_settings path into its component segments.

static parse_data_stream_path(path: str) Dict[str, str]

Parses a data_stream path into its component segments.

Parses a firebase_link path into its component segments.

Parses a google_ads_link path into its component segments.

static parse_measurement_protocol_secret_path(path: str) Dict[str, str]

Parses a measurement_protocol_secret path into its component segments.

static parse_property_path(path: str) Dict[str, str]

Parses a property path into its component segments.

static property_path(property: str) str

Returns a fully-qualified property string.

async provision_account_ticket(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ProvisionAccountTicketRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.analytics_admin.ProvisionAccountTicketResponse[source]

Requests a ticket for creating an account.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_provision_account_ticket():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.ProvisionAccountTicketRequest(
    )

    # Make the request
    response = await client.provision_account_ticket(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.ProvisionAccountTicketRequest, dict]]) – The request object. Request message for ProvisionAccountTicket RPC.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ProvisionAccountTicket RPC.

Return type

google.analytics.admin_v1beta.types.ProvisionAccountTicketResponse

async run_access_report(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.RunAccessReportRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.analytics_admin.RunAccessReportResponse[source]

Returns a customized report of data access records. The report provides records of each time a user reads Google Analytics reporting data. Access records are retained for up to 2 years.

Data Access Reports can be requested for a property. The property must be in Google Analytics 360. This method is only available to Administrators.

These data access records include GA4 UI Reporting, GA4 UI Explorations, GA4 Data API, and other products like Firebase & Admob that can retrieve data from Google Analytics through a linkage. These records don’t include property configuration changes like adding a stream or changing a property’s time zone. For configuration change history, see searchChangeHistoryEvents.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_run_access_report():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.RunAccessReportRequest(
    )

    # Make the request
    response = await client.run_access_report(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.RunAccessReportRequest, dict]]) – The request object. The request for a Data Access Record Report.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The customized Data Access Record Report response.

Return type

google.analytics.admin_v1beta.types.RunAccessReportResponse

async search_change_history_events(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.SearchChangeHistoryEventsRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.services.analytics_admin_service.pagers.SearchChangeHistoryEventsAsyncPager[source]

Searches through all changes to an account or its children given the specified set of filters.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_search_change_history_events():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.SearchChangeHistoryEventsRequest(
        account="account_value",
    )

    # Make the request
    page_result = client.search_change_history_events(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.SearchChangeHistoryEventsRequest, dict]]) – The request object. Request message for SearchChangeHistoryEvents RPC.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for SearchAccounts RPC. Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.analytics.admin_v1beta.services.analytics_admin_service.pagers.SearchChangeHistoryEventsAsyncPager

property transport: google.analytics.admin_v1beta.services.analytics_admin_service.transports.base.AnalyticsAdminServiceTransport

Returns the transport used by the client instance.

Returns

The transport used by the client instance.

Return type

AnalyticsAdminServiceTransport

property universe_domain: str

Return the universe domain used by the client instance.

Returns

The universe domain used

by the client instance.

Return type

str

async update_account(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateAccountRequest, dict]] = None, *, account: Optional[google.analytics.admin_v1beta.types.resources.Account] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Account[source]

Updates an account.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_account():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    account = admin_v1beta.Account()
    account.display_name = "display_name_value"

    request = admin_v1beta.UpdateAccountRequest(
        account=account,
    )

    # Make the request
    response = await client.update_account(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateAccountRequest, dict]]) – The request object. Request message for UpdateAccount RPC.

  • account (google.analytics.admin_v1beta.types.Account) –

    Required. The account to update. The account’s name field is used to identify the account.

    This corresponds to the account field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Field names must be in snake case (for example, “field_to_update”). Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics account.

Return type

google.analytics.admin_v1beta.types.Account

async update_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateConversionEventRequest, dict]] = None, *, conversion_event: Optional[google.analytics.admin_v1beta.types.resources.ConversionEvent] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.ConversionEvent[source]

Updates a conversion event with the specified attributes.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.UpdateConversionEventRequest(
    )

    # Make the request
    response = await client.update_conversion_event(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateConversionEventRequest, dict]]) – The request object. Request message for UpdateConversionEvent RPC

  • conversion_event (google.analytics.admin_v1beta.types.ConversionEvent) –

    Required. The conversion event to update. The name field is used to identify the settings to be updated.

    This corresponds to the conversion_event field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Field names must be in snake case (e.g., “field_to_update”). Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A conversion event in a Google Analytics property.

Return type

google.analytics.admin_v1beta.types.ConversionEvent

async update_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateCustomDimensionRequest, dict]] = None, *, custom_dimension: Optional[google.analytics.admin_v1beta.types.resources.CustomDimension] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomDimension[source]

Updates a CustomDimension on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.UpdateCustomDimensionRequest(
    )

    # Make the request
    response = await client.update_custom_dimension(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateCustomDimensionRequest, dict]]) – The request object. Request message for UpdateCustomDimension RPC.

  • custom_dimension (google.analytics.admin_v1beta.types.CustomDimension) – The CustomDimension to update This corresponds to the custom_dimension field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a CustomDimension.

Return type

google.analytics.admin_v1beta.types.CustomDimension

async update_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateCustomMetricRequest, dict]] = None, *, custom_metric: Optional[google.analytics.admin_v1beta.types.resources.CustomMetric] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomMetric[source]

Updates a CustomMetric on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.UpdateCustomMetricRequest(
    )

    # Make the request
    response = await client.update_custom_metric(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateCustomMetricRequest, dict]]) – The request object. Request message for UpdateCustomMetric RPC.

  • custom_metric (google.analytics.admin_v1beta.types.CustomMetric) – The CustomMetric to update This corresponds to the custom_metric field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a custom metric.

Return type

google.analytics.admin_v1beta.types.CustomMetric

async update_data_retention_settings(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateDataRetentionSettingsRequest, dict]] = None, *, data_retention_settings: Optional[google.analytics.admin_v1beta.types.resources.DataRetentionSettings] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataRetentionSettings[source]

Updates the singleton data retention settings for this property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_data_retention_settings():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.UpdateDataRetentionSettingsRequest(
    )

    # Make the request
    response = await client.update_data_retention_settings(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateDataRetentionSettingsRequest, dict]]) – The request object. Request message for UpdateDataRetentionSettings RPC.

  • data_retention_settings (google.analytics.admin_v1beta.types.DataRetentionSettings) –

    Required. The settings to update. The name field is used to identify the settings to be updated.

    This corresponds to the data_retention_settings field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Field names must be in snake case (e.g., “field_to_update”). Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Settings values for data retention. This is a singleton resource.

Return type

google.analytics.admin_v1beta.types.DataRetentionSettings

async update_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateDataStreamRequest, dict]] = None, *, data_stream: Optional[google.analytics.admin_v1beta.types.resources.DataStream] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataStream[source]

Updates a DataStream on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.UpdateDataStreamRequest(
    )

    # Make the request
    response = await client.update_data_stream(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateDataStreamRequest, dict]]) – The request object. Request message for UpdateDataStream RPC.

  • data_stream (google.analytics.admin_v1beta.types.DataStream) – The DataStream to update This corresponds to the data_stream field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a data stream.

Return type

google.analytics.admin_v1beta.types.DataStream

Updates a GoogleAdsLink on a property

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_google_ads_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    request = admin_v1beta.UpdateGoogleAdsLinkRequest(
    )

    # Make the request
    response = await client.update_google_ads_link(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateGoogleAdsLinkRequest, dict]]) – The request object. Request message for UpdateGoogleAdsLink RPC

  • google_ads_link (google.analytics.admin_v1beta.types.GoogleAdsLink) – The GoogleAdsLink to update This corresponds to the google_ads_link field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Field names must be in snake case (e.g., “field_to_update”). Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A link between a GA4 property and a Google Ads account.

Return type

google.analytics.admin_v1beta.types.GoogleAdsLink

async update_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdateMeasurementProtocolSecretRequest, dict]] = None, *, measurement_protocol_secret: Optional[google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret[source]

Updates a measurement protocol secret.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_measurement_protocol_secret():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    measurement_protocol_secret = admin_v1beta.MeasurementProtocolSecret()
    measurement_protocol_secret.display_name = "display_name_value"

    request = admin_v1beta.UpdateMeasurementProtocolSecretRequest(
        measurement_protocol_secret=measurement_protocol_secret,
    )

    # Make the request
    response = await client.update_measurement_protocol_secret(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdateMeasurementProtocolSecretRequest, dict]]) – The request object. Request message for UpdateMeasurementProtocolSecret RPC

  • measurement_protocol_secret (google.analytics.admin_v1beta.types.MeasurementProtocolSecret) –

    Required. The measurement protocol secret to update.

    This corresponds to the measurement_protocol_secret field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Omitted fields will not be updated.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A secret value used for sending hits to Measurement Protocol.

Return type

google.analytics.admin_v1beta.types.MeasurementProtocolSecret

async update_property(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.UpdatePropertyRequest, dict]] = None, *, property: Optional[google.analytics.admin_v1beta.types.resources.Property] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Property[source]

Updates a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

async def sample_update_property():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceAsyncClient()

    # Initialize request argument(s)
    property = admin_v1beta.Property()
    property.display_name = "display_name_value"
    property.time_zone = "time_zone_value"

    request = admin_v1beta.UpdatePropertyRequest(
        property=property,
    )

    # Make the request
    response = await client.update_property(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.analytics.admin_v1beta.types.UpdatePropertyRequest, dict]]) – The request object. Request message for UpdateProperty RPC.

  • property (google.analytics.admin_v1beta.types.Property) –

    Required. The property to update. The property’s name field is used to identify the property to be updated.

    This corresponds to the property field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to be updated. Field names must be in snake case (e.g., “field_to_update”). Omitted fields will not be updated. To replace the entire entity, use one path with the string “*” to match all fields.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics GA4 property.

Return type

google.analytics.admin_v1beta.types.Property

class google.analytics.admin_v1beta.services.analytics_admin_service.AnalyticsAdminServiceClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.analytics.admin_v1beta.services.analytics_admin_service.transports.base.AnalyticsAdminServiceTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]

Service Interface for the Analytics Admin API (GA4).

Instantiates the analytics admin service client.

Parameters
  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

  • transport (Union[str, AnalyticsAdminServiceTransport]) – The transport to use. If set to None, a transport is chosen automatically.

  • client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –

    Custom options for the client.

    1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).

    2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.

    3. The universe_domain property can be used to override the default “googleapis.com” universe. Note that the api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

Raises

google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.

__exit__(type, value, traceback)[source]

Releases underlying transport’s resources.

Warning

ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!

static account_path(account: str) str[source]

Returns a fully-qualified account string.

static account_summary_path(account_summary: str) str[source]

Returns a fully-qualified account_summary string.

acknowledge_user_data_collection(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.AcknowledgeUserDataCollectionRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.analytics_admin.AcknowledgeUserDataCollectionResponse[source]

Acknowledges the terms of user data collection for the specified property. This acknowledgement must be completed (either in the Google Analytics UI or through this API) before MeasurementProtocolSecret resources may be created.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_acknowledge_user_data_collection():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.AcknowledgeUserDataCollectionRequest(
        property="property_value",
        acknowledgement="acknowledgement_value",
    )

    # Make the request
    response = client.acknowledge_user_data_collection(request=request)

    # Handle the response
    print(response)
Parameters
Returns

Response message for AcknowledgeUserDataCollection RPC.

Return type

google.analytics.admin_v1beta.types.AcknowledgeUserDataCollectionResponse

property api_endpoint

Return the API endpoint used by the client instance.

Returns

The API endpoint used by the client instance.

Return type

str

archive_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ArchiveCustomDimensionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Archives a CustomDimension on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_archive_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.ArchiveCustomDimensionRequest(
        name="name_value",
    )

    # Make the request
    client.archive_custom_dimension(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.ArchiveCustomDimensionRequest, dict]) – The request object. Request message for ArchiveCustomDimension RPC.

  • name (str) –

    Required. The name of the CustomDimension to archive. Example format: properties/1234/customDimensions/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

archive_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.ArchiveCustomMetricRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Archives a CustomMetric on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_archive_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.ArchiveCustomMetricRequest(
        name="name_value",
    )

    # Make the request
    client.archive_custom_metric(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.ArchiveCustomMetricRequest, dict]) – The request object. Request message for ArchiveCustomMetric RPC.

  • name (str) –

    Required. The name of the CustomMetric to archive. Example format: properties/1234/customMetrics/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

static common_billing_account_path(billing_account: str) str[source]

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str[source]

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str[source]

Returns a fully-qualified location string.

static common_organization_path(organization: str) str[source]

Returns a fully-qualified organization string.

static common_project_path(project: str) str[source]

Returns a fully-qualified project string.

static conversion_event_path(property: str, conversion_event: str) str[source]

Returns a fully-qualified conversion_event string.

create_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateConversionEventRequest, dict]] = None, *, parent: Optional[str] = None, conversion_event: Optional[google.analytics.admin_v1beta.types.resources.ConversionEvent] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.ConversionEvent[source]

Creates a conversion event with the specified attributes.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.CreateConversionEventRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.create_conversion_event(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateConversionEventRequest, dict]) – The request object. Request message for CreateConversionEvent RPC

  • parent (str) –

    Required. The resource name of the parent property where this conversion event will be created. Format: properties/123

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • conversion_event (google.analytics.admin_v1beta.types.ConversionEvent) –

    Required. The conversion event to create.

    This corresponds to the conversion_event field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A conversion event in a Google Analytics property.

Return type

google.analytics.admin_v1beta.types.ConversionEvent

create_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateCustomDimensionRequest, dict]] = None, *, parent: Optional[str] = None, custom_dimension: Optional[google.analytics.admin_v1beta.types.resources.CustomDimension] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomDimension[source]

Creates a CustomDimension.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    custom_dimension = admin_v1beta.CustomDimension()
    custom_dimension.parameter_name = "parameter_name_value"
    custom_dimension.display_name = "display_name_value"
    custom_dimension.scope = "ITEM"

    request = admin_v1beta.CreateCustomDimensionRequest(
        parent="parent_value",
        custom_dimension=custom_dimension,
    )

    # Make the request
    response = client.create_custom_dimension(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateCustomDimensionRequest, dict]) – The request object. Request message for CreateCustomDimension RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • custom_dimension (google.analytics.admin_v1beta.types.CustomDimension) –

    Required. The CustomDimension to create.

    This corresponds to the custom_dimension field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a CustomDimension.

Return type

google.analytics.admin_v1beta.types.CustomDimension

create_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateCustomMetricRequest, dict]] = None, *, parent: Optional[str] = None, custom_metric: Optional[google.analytics.admin_v1beta.types.resources.CustomMetric] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomMetric[source]

Creates a CustomMetric.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    custom_metric = admin_v1beta.CustomMetric()
    custom_metric.parameter_name = "parameter_name_value"
    custom_metric.display_name = "display_name_value"
    custom_metric.measurement_unit = "HOURS"
    custom_metric.scope = "EVENT"

    request = admin_v1beta.CreateCustomMetricRequest(
        parent="parent_value",
        custom_metric=custom_metric,
    )

    # Make the request
    response = client.create_custom_metric(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateCustomMetricRequest, dict]) – The request object. Request message for CreateCustomMetric RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • custom_metric (google.analytics.admin_v1beta.types.CustomMetric) – Required. The CustomMetric to create. This corresponds to the custom_metric field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a custom metric.

Return type

google.analytics.admin_v1beta.types.CustomMetric

create_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateDataStreamRequest, dict]] = None, *, parent: Optional[str] = None, data_stream: Optional[google.analytics.admin_v1beta.types.resources.DataStream] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataStream[source]

Creates a DataStream.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    data_stream = admin_v1beta.DataStream()
    data_stream.type_ = "IOS_APP_DATA_STREAM"

    request = admin_v1beta.CreateDataStreamRequest(
        parent="parent_value",
        data_stream=data_stream,
    )

    # Make the request
    response = client.create_data_stream(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateDataStreamRequest, dict]) – The request object. Request message for CreateDataStream RPC.

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • data_stream (google.analytics.admin_v1beta.types.DataStream) – Required. The DataStream to create. This corresponds to the data_stream field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a data stream.

Return type

google.analytics.admin_v1beta.types.DataStream

Creates a FirebaseLink.

Properties can have at most one FirebaseLink.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_firebase_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.CreateFirebaseLinkRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.create_firebase_link(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateFirebaseLinkRequest, dict]) – The request object. Request message for CreateFirebaseLink RPC

  • parent (str) –

    Required. Format: properties/{property_id} Example: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • firebase_link (google.analytics.admin_v1beta.types.FirebaseLink) –

    Required. The Firebase link to create.

    This corresponds to the firebase_link field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A link between a GA4 property and a Firebase project.

Return type

google.analytics.admin_v1beta.types.FirebaseLink

Creates a GoogleAdsLink.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_google_ads_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.CreateGoogleAdsLinkRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.create_google_ads_link(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateGoogleAdsLinkRequest, dict]) – The request object. Request message for CreateGoogleAdsLink RPC

  • parent (str) –

    Required. Example format: properties/1234

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • google_ads_link (google.analytics.admin_v1beta.types.GoogleAdsLink) –

    Required. The GoogleAdsLink to create.

    This corresponds to the google_ads_link field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A link between a GA4 property and a Google Ads account.

Return type

google.analytics.admin_v1beta.types.GoogleAdsLink

create_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreateMeasurementProtocolSecretRequest, dict]] = None, *, parent: Optional[str] = None, measurement_protocol_secret: Optional[google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret[source]

Creates a measurement protocol secret.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_measurement_protocol_secret():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    measurement_protocol_secret = admin_v1beta.MeasurementProtocolSecret()
    measurement_protocol_secret.display_name = "display_name_value"

    request = admin_v1beta.CreateMeasurementProtocolSecretRequest(
        parent="parent_value",
        measurement_protocol_secret=measurement_protocol_secret,
    )

    # Make the request
    response = client.create_measurement_protocol_secret(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.CreateMeasurementProtocolSecretRequest, dict]) – The request object. Request message for CreateMeasurementProtocolSecret RPC

  • parent (str) –

    Required. The parent resource where this secret will be created. Format: properties/{property}/dataStreams/{dataStream}

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • measurement_protocol_secret (google.analytics.admin_v1beta.types.MeasurementProtocolSecret) –

    Required. The measurement protocol secret to create.

    This corresponds to the measurement_protocol_secret field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A secret value used for sending hits to Measurement Protocol.

Return type

google.analytics.admin_v1beta.types.MeasurementProtocolSecret

create_property(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.CreatePropertyRequest, dict]] = None, *, property: Optional[google.analytics.admin_v1beta.types.resources.Property] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Property[source]

Creates an “GA4” property with the specified location and attributes.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_create_property():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    property = admin_v1beta.Property()
    property.display_name = "display_name_value"
    property.time_zone = "time_zone_value"

    request = admin_v1beta.CreatePropertyRequest(
        property=property,
    )

    # Make the request
    response = client.create_property(request=request)

    # Handle the response
    print(response)
Parameters
Returns

A resource message representing a Google Analytics GA4 property.

Return type

google.analytics.admin_v1beta.types.Property

static custom_dimension_path(property: str, custom_dimension: str) str[source]

Returns a fully-qualified custom_dimension string.

static custom_metric_path(property: str, custom_metric: str) str[source]

Returns a fully-qualified custom_metric string.

static data_retention_settings_path(property: str) str[source]

Returns a fully-qualified data_retention_settings string.

static data_sharing_settings_path(account: str) str[source]

Returns a fully-qualified data_sharing_settings string.

static data_stream_path(property: str, data_stream: str) str[source]

Returns a fully-qualified data_stream string.

delete_account(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteAccountRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Marks target Account as soft-deleted (ie: “trashed”) and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI.

If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_account():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteAccountRequest(
        name="name_value",
    )

    # Make the request
    client.delete_account(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeleteAccountRequest, dict]) – The request object. Request message for DeleteAccount RPC.

  • name (str) –

    Required. The name of the Account to soft-delete. Format: accounts/{account} Example: “accounts/100”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

delete_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteConversionEventRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a conversion event in a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteConversionEventRequest(
        name="name_value",
    )

    # Make the request
    client.delete_conversion_event(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeleteConversionEventRequest, dict]) – The request object. Request message for DeleteConversionEvent RPC

  • name (str) –

    Required. The resource name of the conversion event to delete. Format: properties/{property}/conversionEvents/{conversion_event} Example: “properties/123/conversionEvents/456”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

delete_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteDataStreamRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a DataStream on a property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteDataStreamRequest(
        name="name_value",
    )

    # Make the request
    client.delete_data_stream(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeleteDataStreamRequest, dict]) – The request object. Request message for DeleteDataStream RPC.

  • name (str) –

    Required. The name of the DataStream to delete. Example format: properties/1234/dataStreams/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Deletes a FirebaseLink on a property

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_firebase_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteFirebaseLinkRequest(
        name="name_value",
    )

    # Make the request
    client.delete_firebase_link(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeleteFirebaseLinkRequest, dict]) – The request object. Request message for DeleteFirebaseLink RPC

  • name (str) –

    Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} Example: properties/1234/firebaseLinks/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Deletes a GoogleAdsLink on a property

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_google_ads_link():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteGoogleAdsLinkRequest(
        name="name_value",
    )

    # Make the request
    client.delete_google_ads_link(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeleteGoogleAdsLinkRequest, dict]) – The request object. Request message for DeleteGoogleAdsLink RPC.

  • name (str) –

    Required. Example format: properties/1234/googleAdsLinks/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

delete_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeleteMeasurementProtocolSecretRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes target MeasurementProtocolSecret.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_measurement_protocol_secret():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeleteMeasurementProtocolSecretRequest(
        name="name_value",
    )

    # Make the request
    client.delete_measurement_protocol_secret(request=request)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeleteMeasurementProtocolSecretRequest, dict]) – The request object. Request message for DeleteMeasurementProtocolSecret RPC

  • name (str) –

    Required. The name of the MeasurementProtocolSecret to delete. Format:

    properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

delete_property(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.DeletePropertyRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Property[source]

Marks target Property as soft-deleted (ie: “trashed”) and returns it. This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI.

If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found, or is not a GA4 Property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_delete_property():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.DeletePropertyRequest(
        name="name_value",
    )

    # Make the request
    response = client.delete_property(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.DeletePropertyRequest, dict]) – The request object. Request message for DeleteProperty RPC.

  • name (str) –

    Required. The name of the Property to soft-delete. Format: properties/{property_id} Example: “properties/1000”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics GA4 property.

Return type

google.analytics.admin_v1beta.types.Property

Returns a fully-qualified firebase_link string.

classmethod from_service_account_file(filename: str, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

AnalyticsAdminServiceClient

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

AnalyticsAdminServiceClient

classmethod from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

AnalyticsAdminServiceClient

get_account(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetAccountRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.Account[source]

Lookup for a single Account.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_account():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetAccountRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_account(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetAccountRequest, dict]) – The request object. Request message for GetAccount RPC.

  • name (str) –

    Required. The name of the account to lookup. Format: accounts/{account} Example: “accounts/100”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a Google Analytics account.

Return type

google.analytics.admin_v1beta.types.Account

get_conversion_event(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetConversionEventRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.ConversionEvent[source]

Retrieve a single conversion event.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_conversion_event():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetConversionEventRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_conversion_event(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetConversionEventRequest, dict]) – The request object. Request message for GetConversionEvent RPC

  • name (str) –

    Required. The resource name of the conversion event to retrieve. Format: properties/{property}/conversionEvents/{conversion_event} Example: “properties/123/conversionEvents/456”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A conversion event in a Google Analytics property.

Return type

google.analytics.admin_v1beta.types.ConversionEvent

get_custom_dimension(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetCustomDimensionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomDimension[source]

Lookup for a single CustomDimension.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_custom_dimension():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetCustomDimensionRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_custom_dimension(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetCustomDimensionRequest, dict]) – The request object. Request message for GetCustomDimension RPC.

  • name (str) –

    Required. The name of the CustomDimension to get. Example format: properties/1234/customDimensions/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a CustomDimension.

Return type

google.analytics.admin_v1beta.types.CustomDimension

get_custom_metric(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetCustomMetricRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.CustomMetric[source]

Lookup for a single CustomMetric.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_custom_metric():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetCustomMetricRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_custom_metric(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetCustomMetricRequest, dict]) – The request object. Request message for GetCustomMetric RPC.

  • name (str) –

    Required. The name of the CustomMetric to get. Example format: properties/1234/customMetrics/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A definition for a custom metric.

Return type

google.analytics.admin_v1beta.types.CustomMetric

get_data_retention_settings(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetDataRetentionSettingsRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataRetentionSettings[source]

Returns the singleton data retention settings for this property.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_data_retention_settings():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetDataRetentionSettingsRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_data_retention_settings(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetDataRetentionSettingsRequest, dict]) – The request object. Request message for GetDataRetentionSettings RPC.

  • name (str) –

    Required. The name of the settings to lookup. Format:

    properties/{property}/dataRetentionSettings Example: “properties/1000/dataRetentionSettings”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Settings values for data retention. This is a singleton resource.

Return type

google.analytics.admin_v1beta.types.DataRetentionSettings

get_data_sharing_settings(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetDataSharingSettingsRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataSharingSettings[source]

Get data sharing settings on an account. Data sharing settings are singletons.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_data_sharing_settings():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetDataSharingSettingsRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_data_sharing_settings(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetDataSharingSettingsRequest, dict]) – The request object. Request message for GetDataSharingSettings RPC.

  • name (str) –

    Required. The name of the settings to lookup. Format: accounts/{account}/dataSharingSettings Example: “accounts/1000/dataSharingSettings”

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing data sharing settings of a Google Analytics account.

Return type

google.analytics.admin_v1beta.types.DataSharingSettings

get_data_stream(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetDataStreamRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.DataStream[source]

Lookup for a single DataStream.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.analytics import admin_v1beta

def sample_get_data_stream():
    # Create a client
    client = admin_v1beta.AnalyticsAdminServiceClient()

    # Initialize request argument(s)
    request = admin_v1beta.GetDataStreamRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_data_stream(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.analytics.admin_v1beta.types.GetDataStreamRequest, dict]) – The request object. Request message for GetDataStream RPC.

  • name (str) –

    Required. The name of the DataStream to get. Example format: properties/1234/dataStreams/5678

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A resource message representing a data stream.

Return type

google.analytics.admin_v1beta.types.DataStream

get_measurement_protocol_secret(request: Optional[Union[google.analytics.admin_v1beta.types.analytics_admin.GetMeasurementProtocolSecretRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.analytics.admin_v1beta.types.resources.MeasurementProtocolSecret[source]

Lookup for a single “GA4” MeasurementProtocolSecret.

# This snippet has been automatically generated and should be regarded as a
# code t