tests.system.providers.google.marketing_platform.example_analytics_admin

Example Airflow DAG that shows how to use Google Analytics (GA4) Admin Operators.

This DAG relies on the following OS environment variables

  • GA_ACCOUNT_ID - Google Analytics account id.

  • GA_GOOGLE_ADS_PROPERTY_ID - Google Analytics property’s id associated with Google Ads Link.

In order to run this test, make sure you followed steps: 1. Login to https://analytics.google.com 2. In the settings section create an account and save its ID in the variable GA_ACCOUNT_ID. 3. In the settings section go to the Property access management page and add your service account email with Editor permissions. This service account should be created on behalf of the account from the step 1. 4. Make sure Google Analytics Admin API is enabled in your GCP project. 5. Create Google Ads account and link it to your Google Analytics account in the GA admin panel. 6. Associate the Google Ads account with a property, and save this property’s id in the variable GA_GOOGLE_ADS_PROPERTY_ID.

Module Contents

Functions

setup_connection(**kwargs)

Attributes

ENV_ID

DAG_ID

CONNECTION_ID

ACCOUNT_ID

PROPERTY_ID

DATA_STREAM_ID

GA_GOOGLE_ADS_PROPERTY_ID

GA_ADS_LINK_ID

log

test_run

tests.system.providers.google.marketing_platform.example_analytics_admin.ENV_ID[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.DAG_ID = 'example_google_analytics_admin'[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.CONNECTION_ID[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.ACCOUNT_ID[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.PROPERTY_ID = "{{ task_instance.xcom_pull('create_property')['name'].split('/')[-1] }}"[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.DATA_STREAM_ID = "{{ task_instance.xcom_pull('create_data_stream')['name'].split('/')[-1] }}"[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.GA_GOOGLE_ADS_PROPERTY_ID[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.log[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.setup_connection(**kwargs)[source]
tests.system.providers.google.marketing_platform.example_analytics_admin.test_run[source]

Was this entry helpful?