# Interface IAnalyticsEvent

The common subset of fields used to describe Coveo Cloud usage analytics search, [_click_](@link IClickEvent), and [_custom_](@link ICustomEvent) events.

## Index

### Properties

- actionCause
- actionType
- anonymous
- clientId
- customData
- device
- language
- mobile
- originContext
- originLevel1
- originLevel2
- originLevel3
- responseTime
- userAgent
- userDisplayName
- userGroups
- username

## Properties

### actionCause

actionCause: string

- Defined in rest/AnalyticsEvent.ts :12

A unique name describing the action that triggered the event.

See the `name` property of the `IAnalyticsActionCause` interface.

Example: `pagerNext`

### actionType

actionType: string

- Defined in rest/AnalyticsEvent.ts :20

A name describing the category of actions to which the action that triggered the event belongs.

See the `type` property of the `IAnalyticsActionCause` interface.

Example: `getMoreResults`

### Optional anonymous

anonymous: boolean

- Defined in rest/AnalyticsEvent.ts :42

Whether the event should be logged anonymously to the Coveo Cloud usage analytics service.

Note: This field is normally set to the `anonymous` option value of the `Analytics` component.

### clientId

clientId: string

- Defined in rest/AnalyticsEvent.ts :131

A GUID representing the current user. This GUID is generated locally and stored in a non-expiring browser cookie.

### Optional customData

customData: object

- Defined in rest/AnalyticsEvent.ts :127

Additional metadata to send along with the event.

Note: This field may include custom user context information (see Sending Custom Context Information).

Example: `{ "currentResultsPerPage": 25, "userRole": "developer" }`

#### Type declaration

- ##### [key: string]: any

### device

device: string

- Defined in rest/AnalyticsEvent.ts :50

The name of the device or browser that triggered the event.

Note: The framework normally sets this field by parsing the current `navigator.userAgent` value.

Example: `Chrome`

### language

language: string

- Defined in rest/AnalyticsEvent.ts :98

The language of the search interface from which the event originates.

Must be a valid ISO-639-1 code.

Note: By default, the framework sets this field according to the currently loaded culture file (see Changing the Language of Your Search Interface).

Example: `en`

### mobile

mobile: boolean

- Defined in rest/AnalyticsEvent.ts :56

Whether the event originates from a mobile device.

Note: The framework normally sets this field by parsing the current `navigator.userAgent` value.

### originContext

originContext: string

- Defined in rest/AnalyticsEvent.ts :88

The broad application context from which the event originates.

Note: By default, the framework sets this field to `Search`. However, you can use the `setOriginContext` method of the `Analytics` component to modify the default value.

Example: `Search`

### originLevel1

originLevel1: string

- Defined in rest/AnalyticsEvent.ts :64

The identifier of the search interface from which the event originates.

Note: This field is normally set through the `searchHub` option of the `Analytics` component. However, when actually recording the event, the Coveo Cloud usage analytics service may override this value with information extracted from the search token.

Example: `PartnerPortalSearch`

### originLevel2

originLevel2: string

- Defined in rest/AnalyticsEvent.ts :72

The identifier of the tab from which the event originates.

Note: The framework normally sets this field to the identifier of the currently selected `Tab` in the search interface.

Example: `All`

### Optional originLevel3

originLevel3: string

- Defined in rest/AnalyticsEvent.ts :80

The address of the webpage that linked to the search interface from which the event originates.

Note: The framework normally sets this field to the current `document.referrer` value.

Example: `http://example.com/`

### responseTime

responseTime: number

- Defined in rest/AnalyticsEvent.ts :105

The time it took to get a response from the Search API for the query related to the event (in milliseconds).

Note: The framework normally sets this field to `0`, except for search events in which case it sets the field by retrieving the information from the related Search API query response.

### Optional userAgent

userAgent: string

- Defined in rest/AnalyticsEvent.ts :113

The software acting on behalf of the end-user whose action triggered the event.

Note: By default, the framework sets this field to the current `navigator.userAgent` value.

Example: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36`

### Optional userDisplayName

userDisplayName: string

- Defined in rest/AnalyticsEvent.ts :36

The display name of the end-user whose action triggered the event.

Note: This field is normally set to the `userDisplayName` option value of the `Analytics` component. However, when actually recording the event, the Coveo Cloud usage analytics service may override this value with information extracted from the search token.

Example: `Alice Smith`

### Optional userGroups

userGroups: string

- Defined in rest/AnalyticsEvent.ts :119

The groups the end-user whose action triggered the event belongs to.

Note: This field is normally left undefined, and the Coveo Cloud usage analytics service attempts to extract the information from the search token when actually recording the event.

### Optional username

username: string

- Defined in rest/AnalyticsEvent.ts :28

The identifier of the end-user whose action triggered the event.

Note: This field is normally set to the `user` option value of the `Analytics` component. However, when actually recording the event, the Coveo Cloud usage analytics service may override this value with information extracted from the search token.

Example: `asmith@example.com`

### Hierarchy

- IAnalyticsEvent