---
title: "Event Collection Methods"
slug: "event-collection-methods"
updated: 2020-04-16T20:16:46Z
published: 2020-04-16T20:16:46Z
canonical: "onpremises.webtrends.help/event-collection-methods"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://onpremises.webtrends.help/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Collection Methods

If you want to instrument your application to collect more complex data, including custom parameter data, you can implement these methods.

## onAdClickEvent

The `onAdClickEvent` method collects data when an application user clicks an ad.

#### Syntax

```
public void onAdClickEvent(String eventPath,
                           String eventDescr,
                           String eventType,
                           Hashtable customData,
                           String adName)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onAdClickEvent("/HelloWorld/adclick/event", "HelloWorld Ad Click Event", "Ad Click Event", customData, "Ad Name");
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.a_an`: adName
- `WT.a_ac`: 1
- `WT.sys`: adclick
- `WT.dl`: 60

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onAdImpression

The `onAdImpression` method collects data when an application user views one or more ads within the application. Because multiple ad impressions can happen within a single screen view, this method can accept multiple ad names in an array.

#### Syntax

```
public void onAdImpressionEvent(String eventPath,
                                String eventDescr,
                                String eventType,
                                Hashtable customData,
                                String[] adNames)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
String[] adNames = { "First Ad Name", "Second Ad Name", "Third Ad Name" };
WTDataCollector.getInstance().onAdImpressionEvent("/HelloWorld/adimpression/event", "HelloWorld Ad Impression Event", customData, adNames);
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.sys`: adimpression
- `WT.dl`: 60
- `WT.a_an`: [adNames objectAtIndex:0] [ ; [adNames objectAtIndex:1] ; ... ]
- `WT.a_ai`: 1[;1;...]

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onButtonClick

The `onButtonClick` method collects data when a user clicks an application button.

#### Syntax

```
public void onButtonClick(String eventPath,
                   String eventDescr,
                   String eventType,
                   Map<String,String> customData)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional) 
Map customData = new HashMap();
customData.put("custom_key", "custom_value");
String[] adNames = { "First Ad Name", "Second Ad Name", "Third Ad Name" };
WTDataCollector.getInstance().onButtonClick("/HelloWorld/adimpression/event", "HelloWorld Ad Impression Event", "Button Event", customData);
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.dl`: 60
- `WT.sys`: button

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onScreenView

The `onScreenView` method collects data when content such as a screen, article, or image is viewed.

#### Syntax

```
public void onScreenView(String eventPath,
           String eventDescr,
           String eventType,
           Map<String,String> customData,
           String contentGroup)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onScreenView("/HelloWorld/screen/view", "HelloWorld Screen View", "view", customData, "Content Group");
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.
- `applicationName`: Specifies an application name associated with application startup, application termination, application foreground, application background, or application error.
- `contentGroup` (optional): Specifies a group of related application views.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.cg_n`: contentGroup
- `WT.dl`: 0
- `WT.sys`: screen

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onConversionEvent

The `onConversionEvent` method collects data when a conversion event, such as a purchase or registration, occurs.

#### Syntax

```
public void onConversionEvent(String eventPath,
                              String eventDescr,
                              String eventType,
                              Map<String,String> customData,
                              String contentGroup,
                              String conversionName)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onConversionEvent("/HelloWorld/conversion/event", "HelloWorld Conversion Event", "event", customData, "Content Group", "Conversion Name");
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.
- `contentGroup` (optional): Specifies a group of related application views.
- `conversionName`: Specifies the name used to identify a customer conversion.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.cg_n`: contentGroup
- `WT.conv`: conversionName
- `WT.si_cs`: 1
- `WT.dl`: 0
- `WT.sys`: conversion
- `WT.fr`: Android Market installation referrer

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onCustomEvent

The `onCustomEvent` method collects data when a developer-defined event of interest occurs.

#### Syntax

```
public void onCustomEvent(String eventPath,
                   String eventDescr,
                   Map<String,String> customData)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onCustomEvent("/HelloWorld/custom/event", "HelloWorld Custom Event", customData);
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.dl`: User defined (default is 0)
- `WT.sys`: custom

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onMediaEvent

The `onMediaEvent` method collects data when a when a media event, such as a user viewing a film clip, occurs.

#### Syntax

```
public void onMediaEvent(String eventPath,
                         String eventDesc,
                         String eventType,
                         Map<String,String> customData,
                         String contentGroup,
                         String mediaName,
                         String mediaType,
                         String mediaEventType)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onMediaEvent("/HelloWorld/media/event", "HelloWorld Media Event", "event", customData, "Content Group", "Media Name", "Media Type", "Media Event Type");
```

#### Parameters

- `contentGroup` (optional): Specifies a group of related application views.
- `applicationName`: Specifies an application name associated with application startup, application termination, application foreground, application background, or application error.
- `mediaName`: Specifies the name of the media content accessed during an event, for example the name of a video clip.
- `mediaType`: Specifies a type of media accessed during the event, such as QuickTime or mp3.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.cg_n`: contentGroup
- `WT.clip_n`: mediaName
- `WT.clip_t`: mediaType
- `WT.clip_ev`: mediaEventType
- `WT.dl`: 60
- `WT.sys`: media

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onProductView

The `onProductView` method collects data when a when a product is viewed.

#### Syntax

```
public void onProductView(String eventPath,
            String eventDescr,
            String eventType,
            Map<String,String> customData,
            String contentGroup,
            String productId,
            String productSku)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onProductView("/HelloWorld/product/view", "HelloWorld Product View", "view", customData, "Content Group", "Product ID", "Product SKU");
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.
- `contentGroup` (optional): Specifies a group of related application views.
- `productId` (optional): Specifies a product identifier.
- `productSku`: Specifies a unique product stock-keeping unit (SKU) number.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.cg_n`: contentGroup
- `WT.pn_id`: productId
- `WT.pn_sku`: productSku
- `WT.dl`: 0
- `WT.sys`: product

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---

## onSearchEvent

The `onSearchEvent` method collects data when an application user searches within the application. This method accepts both the search term and the result.

#### Syntax

```
public void onSearchEvent(String eventPath,
                        String eventDescr,
                        String eventType,
                        Map<String,String> customData,
                        String searchPhrase,
                        String searchResult)
```

#### Example

```
// send custom key/value pairs as arguments to event methods (optional)
Map <String, String> customData = new HashMap<String, String>();
customData.put("custom_key", "custom_value");
WTDataCollector.getInstance().onSearchEvent("/HelloWorld/custom/event", "HelloWorld Custom Event", "glasses", "3");
```

#### Parameters

- `eventPath`: Specifies the hierarchical representation of an application view at the time of the event. For example, this parameter can specify an application path.
- `eventDesc`: Specifies the representation of an application view at the time of the event. For example, this parameter can specify the name of a screen.
- `eventType`: Specifies the type of event that occurred, such as a view or click.
- `customData` (optional): Specifies a series of custom name-value parameters used to pass data that is not included in the method.

#### Webtrends Parameter Values

- `dcsuri`: eventPath
- `WT.ti`: eventDescr
- `WT.pi`: eventDescr
- `WT.ev`: eventType
- `WT.oss`: searchPhrase
- `WT.oss_r`: searchResult
- `WT.dl`: 0
- `WT.sys`: search

Additional parameters sent in every event are detailed in the Webtrends Parameters Sent by the Mobile SDK section.

---
