google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

[python-analytics-admin] Questions about activating Google Signals

Open rafaelft1988 opened this issue 3 years ago • 4 comments

Hi

I'm trying to activate the google signals setting using the API, but I'm having some issues with that. I don't know if I'm doing something wrong, but when I try to use the update_google_signals_settings on a property without google signals active, I get the following error message:

google.api_core.exceptions.FailedPrecondition: 400 Google Signals must be activated on this property before its enable state may be changed.

However, when I try to update the google signals settings on a property that I already activated the google signals (directly on the property settings), I'm able to change the settings.

So, I don't know if is not possible to activate signals using the API, or if I'm doing something wrong.

rafaelft1988 avatar Oct 28 '22 19:10 rafaelft1988

Hi @rafaelft1988, Please could you share the code that you're using to help re-create this issue?

parthea avatar Nov 08 '22 01:11 parthea

Hi @parthea , here's the code that I'm using. Just need to change the zeroes with a property id that doesn't have google signals active:

from google.analytics import admin_v1alpha
from google.analytics.admin import AnalyticsAdminServiceClient
import os

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'credentials.json'

client = AnalyticsAdminServiceClient()

google_signals = admin_v1alpha.GoogleSignalsSettings(
    name='properties/000000000/googleSignalsSettings',
    state='GOOGLE_SIGNALS_ENABLED',
    consent='GOOGLE_SIGNALS_CONSENT_CONSENTED'        
)

request = admin_v1alpha.UpdateGoogleSignalsSettingsRequest(
    google_signals_settings=google_signals,
    update_mask="*"
)

response = client.update_google_signals_settings(request=request)

print (response)

When i run this code, I get this error:

google.api_core.exceptions.FailedPrecondition: 400 Google Signals must be activated on this property before its enable state may be changed.

Thanks

rafael-tolentino avatar Nov 08 '22 15:11 rafael-tolentino

Hey @parthea, I'm also facing this issue with google-analytics-admin version 0.14.0. Is this expected to be resolved soon?

Thanks in advance!

kitjohnston avatar Mar 21 '23 21:03 kitjohnston

Moving to google-cloud-python repository.

b/230723724

suztomo avatar Aug 17 '23 14:08 suztomo