试用 Google Analytics 的 MCP 服务器。从
GitHub 安装,并参阅
公告了解详情。
REST Resource: properties.keyEvents
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
资源:KeyEvent
Google Analytics 媒体资源中的关键事件。
JSON 表示法 |
{
"name": string,
"eventName": string,
"createTime": string,
"deletable": boolean,
"custom": boolean,
"countingMethod": enum (CountingMethod ),
"defaultValue": {
object (DefaultValue )
}
} |
字段 |
name |
string
仅限输出。此关键事件的资源名称。格式:properties/{property}/keyEvents/{keyEvent}
|
eventName |
string
不可变。此按键事件的事件名称。示例:“点击”“购买”
|
createTime |
string (Timestamp format)
仅限输出。此关键事件在媒体资源中创建的时间。 采用 RFC 3339 标准,生成的输出将始终在末尾带 Z,并使用 0、3、6 或 9 个小数位。不带“Z”的偏差时间也是可以接受的。示例:"2014-10-02T15:01:23Z" 、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30" 。
|
deletable |
boolean
仅限输出。如果设置为 true,则可以删除此事件。
|
custom |
boolean
仅限输出。如果设为 true,此关键事件将引用自定义事件。如果设置为 false,此关键事件将引用 GA 中的默认事件。默认事件通常在 GA 中具有特殊含义。默认事件通常由 GA 系统为您创建,但在某些情况下,媒体资源管理员也可以创建默认事件。自定义事件会计入每项媒体资源可创建的自定义关键事件的数量上限。
|
countingMethod |
enum (CountingMethod )
必需。系统跨会话内的多个事件统计关键事件的方式。
|
defaultValue |
object (DefaultValue )
可选。为关键事件定义默认值/币种。
|
CountingMethod
枚举 |
COUNTING_METHOD_UNSPECIFIED |
未指定统计方法。 |
ONCE_PER_EVENT |
每个事件实例都被视为关键事件。 |
ONCE_PER_SESSION |
每个用户在每次会话中最多将一个事件实例视为关键事件。 |
DefaultValue
JSON 表示法 |
{
"numericValue": number,
"currencyCode": string
} |
字段 |
numericValue |
number
必需。此值将用于为此关键事件(由 eventName 指定)的所有出现情况填充“value”参数,前提是该参数未设置。
|
currencyCode |
string
必需。如果此关键事件(由 eventName 指定)的某个实例未设置货币,系统会将此货币应用为默认货币。必须采用 ISO 4217 货币代码格式。 如需了解详情,请参阅 https://en.wikipedia.org/wiki/ISO_4217。
|
方法 |
|
创建关键事件。 |
|
删除关键事件。 |
|
检索单个按键事件。 |
|
返回指定父级媒体资源中的按键事件列表。 |
|
更新关键事件。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eKeyEvent resources represent significant events within a Google Analytics property, such as clicks or purchases, and can be custom or default.\u003c/p\u003e\n"],["\u003cp\u003eKey Events have a counting method that determines how they are tallied across multiple events in a session (e.g., once per event or once per session).\u003c/p\u003e\n"],["\u003cp\u003eIt is possible to define a default numeric value and currency for a Key Event, which will be used if these parameters are not set in the event data.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Analytics provides API methods to manage Key Events, including creating, deleting, retrieving, listing, and updating them.\u003c/p\u003e\n"]]],["Key Events in Google Analytics track specific actions within a property, identified by an `eventName`. Each Key Event can have a `countingMethod` (`ONCE_PER_EVENT` or `ONCE_PER_SESSION`). They may have a `defaultValue` with a `numericValue` and `currencyCode`. Key Events are created, retrieved, listed, updated, and deleted via dedicated methods. Key events can be default or custom and store information such as if they are deletable, their creation time and their resource name.\n"],null,["# REST Resource: properties.keyEvents\n\n- [Resource: KeyEvent](#KeyEvent)\n - [JSON representation](#KeyEvent.SCHEMA_REPRESENTATION)\n- [CountingMethod](#CountingMethod)\n- [DefaultValue](#DefaultValue)\n - [JSON representation](#DefaultValue.SCHEMA_REPRESENTATION)\n- [Methods](#METHODS_SUMMARY)\n\nResource: KeyEvent\n------------------\n\nA key event in a Google Analytics property.\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"eventName\": string, \"createTime\": string, \"deletable\": boolean, \"custom\": boolean, \"countingMethod\": enum (/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents#CountingMethod), \"defaultValue\": { object (/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents#DefaultValue) } } ``` |\n\n| Fields ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Output only. Resource name of this key event. Format: properties/{property}/keyEvents/{keyEvent} |\n| `eventName` | `string` Immutable. The event name for this key event. Examples: 'click', 'purchase' |\n| `createTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Output only. Time when this key event was created in the property. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |\n| `deletable` | `boolean` Output only. If set to true, this event can be deleted. |\n| `custom` | `boolean` Output only. If set to true, this key event refers to a custom event. If set to false, this key event refers to a default event in GA. Default events typically have special meaning in GA. Default events are usually created for you by the GA system, but in some cases can be created by property admins. Custom events count towards the maximum number of custom key events that may be created per property. |\n| `countingMethod` | `enum (`[CountingMethod](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents#CountingMethod)`)` Required. The method by which Key Events will be counted across multiple events within a session. |\n| `defaultValue` | `object (`[DefaultValue](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents#DefaultValue)`)` Optional. Defines a default value/currency for a key event. |\n\nCountingMethod\n--------------\n\nThe method by which Key Events will be counted across multiple events within a session.\n\n| Enums ||\n|-------------------------------|--------------------------------------------------------------------------------|\n| `COUNTING_METHOD_UNSPECIFIED` | Counting method not specified. |\n| `ONCE_PER_EVENT` | Each Event instance is considered a Key Event. |\n| `ONCE_PER_SESSION` | An Event instance is considered a Key Event at most once per session per user. |\n\nDefaultValue\n------------\n\nDefines a default value/currency for a key event.\n\n| JSON representation |\n|------------------------------------------------------------|\n| ``` { \"numericValue\": number, \"currencyCode\": string } ``` |\n\n| Fields ||\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `numericValue` | `number` Required. This will be used to populate the \"value\" parameter for all occurrences of this Key Event (specified by eventName) where that parameter is unset. |\n| `currencyCode` | `string` Required. When an occurrence of this Key Event (specified by eventName) has no set currency this currency will be applied as the default. Must be in ISO 4217 currency code format. See \u003chttps://en.wikipedia.org/wiki/ISO_4217\u003e for more information. |\n\n| Methods ------- ||\n|--------------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| ### [create](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents/create) | Creates a Key Event. |\n| ### [delete](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents/delete) | Deletes a Key Event. |\n| ### [get](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents/get) | Retrieve a single Key Event. |\n| ### [list](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents/list) | Returns a list of Key Events in the specified parent property. |\n| ### [patch](/analytics/devguides/config/admin/v1/rest/v1beta/properties.keyEvents/patch) | Updates a Key Event. |"]]