# Google Analytics Admin V1alpha Client - Class KeyEvent (0.32.0)

0.32.0 (latest) 0.31.3 0.30.0 0.29.1 0.28.1 0.27.0 0.26.0 0.25.2 0.24.2 0.23.0 0.22.5 0.20.0 0.19.0 0.18.1 0.17.0 0.16.0 0.15.1 0.14.0 0.13.0 0.12.0 0.11.1 0.10.0 0.9.0 0.8.2

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

Reference documentation and code samples for the Google Analytics Admin V1alpha Client class KeyEvent.

A key event in a Google Analytics property.

Generated from protobuf message `google.analytics.admin.v1alpha.KeyEvent`

## Namespace

Google \\ Analytics \\ Admin \\ V1alpha

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. Resource name of this key event. Format: properties/{property}/keyEvents/{key_event} |
| `↳ event_name` | `string` Immutable. The event name for this key event. Examples: 'click', 'purchase' |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when this key event was created in the property. |
| `↳ deletable` | `bool` Output only. If set to true, this event can be deleted. |
| `↳ custom` | `bool` 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. |
| `↳ counting_method` | `int` Required. The method by which Key Events will be counted across multiple events within a session. |
| `↳ default_value` | `https://docs.cloud.google.com/php/docs/reference/analytics-admin/latest/V1alpha.KeyEvent.DefaultValue` Optional. Defines a default value/currency for a key event. |

### getName

Output only. Resource name of this key event.

Format: properties/{property}/keyEvents/{key_event}

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Output only. Resource name of this key event.

Format: properties/{property}/keyEvents/{key_event}

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEventName

Immutable. The event name for this key event.

Examples: 'click', 'purchase'

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEventName

Immutable. The event name for this key event.

Examples: 'click', 'purchase'

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. Time when this key event was created in the property.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Time when this key event was created in the property.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDeletable

Output only. If set to true, this event can be deleted.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setDeletable

Output only. If set to true, this event can be deleted.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCustom

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setCustom

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCountingMethod

Required. The method by which Key Events will be counted across multiple
events within a session.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [CountingMethod](https://docs.cloud.google.com/php/docs/reference/analytics-admin/latest/V1alpha.KeyEvent.CountingMethod). |

### setCountingMethod

Required. The method by which Key Events will be counted across multiple
events within a session.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [CountingMethod](https://docs.cloud.google.com/php/docs/reference/analytics-admin/latest/V1alpha.KeyEvent.CountingMethod). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDefaultValue

Optional. Defines a default value/currency for a key event.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/analytics-admin/latest/V1alpha.KeyEvent.DefaultValue|null` |   |

### hasDefaultValue

### clearDefaultValue

### setDefaultValue

Optional. Defines a default value/currency for a key event.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/analytics-admin/latest/V1alpha.KeyEvent.DefaultValue` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |