14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
- """Google Analytics Admin API sample application which prints the conversion
17
+ """Google Analytics Admin API sample application which prints the key
18
18
event details.
19
19
20
- See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents /get
20
+ See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.keyEvents /get
21
21
for more information.
22
22
"""
23
- # [START analyticsadmin_properties_conversion_events_get ]
23
+ # [START analyticsadmin_properties_key_events_get ]
24
24
from google .analytics .admin import AnalyticsAdminServiceClient
25
25
26
26
@@ -30,38 +30,36 @@ def run_sample():
30
30
# property ID (e.g. "123456") before running the sample.
31
31
property_id = "YOUR-GA4-PROPERTY-ID"
32
32
33
- # TODO(developer): Replace this variable with your conversion event ID
33
+ # TODO(developer): Replace this variable with your key event ID
34
34
# (e.g. "123456") before running the sample.
35
- conversion_event_id = "YOUR-CONVERSION -EVENT-ID"
35
+ key_event_id = "YOUR-KEY -EVENT-ID"
36
36
37
- get_conversion_event (property_id , conversion_event_id )
37
+ get_key_event (property_id , key_event_id )
38
38
39
39
40
- def get_conversion_event (
41
- property_id : str , conversion_event_id : str , transport : str = None
42
- ):
40
+ def get_key_event (property_id : str , key_event_id : str , transport : str = None ):
43
41
"""
44
- Retrieves the details for the conversion event.
42
+ Retrieves the details for the key event.
45
43
Args:
46
44
property_id(str): The Google Analytics Property ID.
47
- conversion_event_id (str): The conversion event ID
45
+ key_event_id (str): The key event ID
48
46
transport(str): The transport to use. For example, "grpc"
49
47
or "rest". If set to None, a transport is chosen automatically.
50
48
"""
51
49
client = AnalyticsAdminServiceClient (transport = transport )
52
- conversion_event = client .get_conversion_event (
53
- name = f"properties/{ property_id } /conversionEvents/ { conversion_event_id } "
50
+ key_event = client .get_key_event (
51
+ name = f"properties/{ property_id } /keyEvents/ { key_event_id } "
54
52
)
55
53
56
54
print ("Result:" )
57
- print (f"Resource name: { conversion_event .name } " )
58
- print (f"Event name: { conversion_event .event_name } " )
59
- print (f"Create time: { conversion_event .create_time } " )
60
- print (f"Deletable: { conversion_event .deletable } " )
61
- print (f"Custom: { conversion_event .custom } " )
55
+ print (f"Resource name: { key_event .name } " )
56
+ print (f"Event name: { key_event .event_name } " )
57
+ print (f"Create time: { key_event .create_time } " )
58
+ print (f"Deletable: { key_event .deletable } " )
59
+ print (f"Custom: { key_event .custom } " )
62
60
63
61
64
- # [END analyticsadmin_properties_conversion_events_get ]
62
+ # [END analyticsadmin_properties_key_events_get ]
65
63
66
64
67
65
if __name__ == "__main__" :
0 commit comments