Skip to content

Commit 1cb6746

Browse files
ikuleshovpull[bot]
authored andcommitted
docs: update region tag names to match the convention (#55)
* docs: update region tag names to match the convention * lint
1 parent ac8d4c4 commit 1cb6746

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

packages/google-analytics-data/samples/snippets/quickstart.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
pip3 install --upgrade google-analytics-data
2727
python3 quickstart.py
2828
"""
29-
# [START google_analytics_data_quickstart]
29+
# [START analyticsdata_quickstart]
3030
from google.analytics.data_v1beta import BetaAnalyticsDataClient
3131
from google.analytics.data_v1beta.types import DateRange
3232
from google.analytics.data_v1beta.types import Dimension
@@ -40,30 +40,30 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID"):
4040
# Google Analytics 4 property ID before running the sample.
4141
# property_id = "YOUR-GA4-PROPERTY-ID"
4242

43-
# [START google_analytics_data_initialize]
43+
# [START analyticsdata_run_report_initialize]
4444
# Using a default constructor instructs the client to use the credentials
4545
# specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
4646
client = BetaAnalyticsDataClient()
47-
# [END google_analytics_data_initialize]
47+
# [END analyticsdata_run_report_initialize]
4848

49-
# [START google_analytics_data_run_report]
49+
# [START analyticsdata_run_report]
5050
request = RunReportRequest(
5151
property="properties/" + str(property_id),
5252
dimensions=[Dimension(name="city")],
5353
metrics=[Metric(name="activeUsers")],
5454
date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
5555
)
5656
response = client.run_report(request)
57-
# [END google_analytics_data_run_report]
57+
# [END analyticsdata_run_report]
5858

59-
# [START google_analytics_data_run_report_response]
59+
# [START analyticsdata_run_report_response]
6060
print("Report result:")
6161
for row in response.rows:
6262
print(row.dimension_values[0].value, row.metric_values[0].value)
63-
# [END google_analytics_data_run_report_response]
63+
# [END analyticsdata_run_report_response]
6464

6565

66-
# [END google_analytics_data_quickstart]
66+
# [END analyticsdata_quickstart]
6767

6868

6969
if __name__ == "__main__":

packages/google-analytics-data/samples/snippets/quickstart_json_credentials.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
pip3 install --upgrade google-analytics-data
2828
python3 quickstart_json_credentials.py
2929
"""
30-
# [START google_analytics_data_quickstart]
30+
# [START analyticsdata_json_credentials_quickstart]
3131
from google.analytics.data_v1beta import BetaAnalyticsDataClient
3232
from google.analytics.data_v1beta.types import DateRange
3333
from google.analytics.data_v1beta.types import Dimension
@@ -41,7 +41,7 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
4141
# Google Analytics 4 property ID before running the sample.
4242
# property_id = "YOUR-GA4-PROPERTY-ID"
4343

44-
# [START google_analytics_data_initialize]
44+
# [START analyticsdata_json_credentials_initialize]
4545
# TODO(developer): Uncomment this variable and replace with a valid path to
4646
# the credentials.json file for your service account downloaded from the
4747
# Cloud Console.
@@ -50,22 +50,24 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
5050
# Explicitly use service account credentials by specifying
5151
# the private key file.
5252
client = BetaAnalyticsDataClient().from_service_account_json(credentials_json_path)
53-
# [END google_analytics_data_initialize]
53+
# [END analyticsdata_json_credentials_initialize]
5454

55-
# [START google_analytics_data_run_report]
55+
# [START analyticsdata_json_credentials_run_report]
5656
request = RunReportRequest(
5757
property="properties/" + str(property_id),
5858
dimensions=[Dimension(name="city")],
5959
metrics=[Metric(name="activeUsers")],
6060
date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
6161
)
6262
response = client.run_report(request)
63-
# [END google_analytics_data_run_report]
63+
# [END analyticsdata_json_credentials_run_report]
6464

6565
print("Report result:")
6666
for row in response.rows:
6767
print(row.dimension_values[0].value, row.metric_values[0].value)
68-
# [END google_analytics_data_quickstart]
68+
69+
70+
# [END analyticsdata_json_credentials_quickstart]
6971

7072

7173
if __name__ == "__main__":

packages/google-analytics-data/samples/snippets/quickstart_oauth2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
pip3 install --upgrade google-analytics-data
2828
python3 quickstart_oauth2.py
2929
"""
30-
# [START google_analytics_data_quickstart]
30+
# [START analyticsdata_quickstart_oauth2]
3131
from google.analytics.data import BetaAnalyticsDataClient
3232
from google.analytics.data_v1beta.types import DateRange
3333
from google.analytics.data_v1beta.types import Dimension
@@ -59,7 +59,7 @@ def sample_run_report(credentials=None, property_id="YOUR-GA4-PROPERTY-ID"):
5959

6060
def get_credentials():
6161
"""Creates an OAuth2 credentials instance."""
62-
# [START google_analytics_data_initialize]
62+
# [START analyticsdata_initialize]
6363
appflow = flow.InstalledAppFlow.from_client_secrets_file(
6464
"client_secrets.json",
6565
scopes=["https://www.googleapis.com/auth/analytics.readonly"],
@@ -75,15 +75,15 @@ def get_credentials():
7575
else:
7676
appflow.run_console()
7777
return appflow.credentials
78-
# [END google_analytics_data_initialize]
78+
# [END analyticsdata_initialize]
7979

8080

8181
def main():
8282
credentials = get_credentials()
8383
sample_run_report(credentials)
8484

8585

86-
# [END google_analytics_data_quickstart]
86+
# [END analyticsdata_quickstart_oauth2]
8787

8888
if __name__ == "__main__":
8989
main()

0 commit comments

Comments
 (0)