# ViewableImpression

## Class Overview

### What is a viewable impression?

A viewable impression is one that has met the following criteria:

- **Pixel Requirement**: Greater than or equal to 50% of the pixels (Density- Independent) in the offer were on an in-focus browser or a fully downloaded, opened, initialized application, on the viewable space of the device.
- **Time Requirement**: The time the pixel requirement is met was greater than or equal to one continuous second, post offer render. The clock starts once the pixel requirement is met.
- **User Interaction**: A strong user interaction with the offer can substitute the above requirements (i.e. a tap on the offer).

##### See Also

- [Interactive Advertising Bureau (IAB)](https://www.iab.com/wp-content/uploads/2015/06/MRC-Viewable-Ad-Impression-Measurement-Guideline.pdf)

## Summary

| Public Constructors |
| --- |
| [ViewableImpression](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#ViewableImpression(java.lang.String,%20java.lang.String,%20com.usebutton.sdk.impression.CreativeType,%20com.usebutton.sdk.impression.VisibleRateType,%20float))( [String](https://d.android.com/reference/java/lang/String.html) url, [String](https://d.android.com/reference/java/lang/String.html) offerId, [CreativeType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/CreativeType.html) creativeType, [VisibleRateType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/VisibleRateType.html) visibleRateType, float visibleRate)<br>Creates a Viewable Impression instance to be tracked. |

| Public Methods |
| --- |
| boolean | [equals](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#equals(java.lang.Object))( [Object](https://d.android.com/reference/java/lang/Object.html) o) |
| [CreativeType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/CreativeType.html) | [getCreativeType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#getCreativeType())()<br>An enum value representing the creative type of the offer associated with this viewable impression. |
| [String](https://d.android.com/reference/java/lang/String.html) | [getOfferId](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#getOfferId())()<br>The optional Button-provided value that identifies the rate of the served offer. |
| [String](https://d.android.com/reference/java/lang/String.html) | [getUrl](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#getUrl())()<br>The URL that is associated with the offer. |
| float | [getVisibleRate](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#getVisibleRate())()<br>The rate visible to the user. |
| [VisibleRateType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/VisibleRateType.html) | [getVisibleRateType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#getVisibleRateType())()<br>An enum value representing type of the visibleRate for the offer that is displayed to the user, either `PERCENT` or `FIXED`. |
| int | [hashCode](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/personalization/ViewableImpression.html#hashCode())() |

## Public Constructors

#### public ViewableImpression( [String](https://d.android.com/reference/java/lang/String.html) url, [String](https://d.android.com/reference/java/lang/String.html) offerId, [CreativeType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/CreativeType.html) creativeType, [VisibleRateType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/VisibleRateType.html) visibleRateType, float visibleRate)

Creates a Viewable Impression instance to be tracked.

##### Parameters

| Parameter | Description |
| --- | --- |
| url | The url of the served offer. |
| offerId | The Button-provided value that identifies the rate of the served offer. |
| creativeType | An enum value representing the creative type of the offer. |
| visibleRateType | The visibleRateType of the served offer. |
| visibleRate | The visibleRate of the served offer. |

## Public Methods

#### public boolean equals( [Object](https://d.android.com/reference/java/lang/Object.html) o)

#### public [CreativeType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/CreativeType.html)getCreativeType()
An enum value representing the creative type of the offer associated with this viewable impression.
Default is `OTHER`

##### Returns

- The enum value representing the creative type of the offer.

#### public [String](https://d.android.com/reference/java/lang/String.html)getOfferId()
The optional Button-provided value that identifies the rate of the served offer.

##### Returns

- The Button-provided value that identifies the rate of the served offer.

#### public [String](https://d.android.com/reference/java/lang/String.html)getUrl()
The URL that is associated with the offer.

##### Returns

- The url of the served offer.

#### public float getVisibleRate()
The rate visible to the user. If the `VisibleRateType` is `FIXED`, this value represents the amount in the currency of the offer. Otherwise, if it is `PERCENT`, this will be a value ranging from 0.0 to 100.0.

##### Returns

- The visible rate of the served offer.

#### public [VisibleRateType](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/impression/VisibleRateType.html)getVisibleRateType()
An enum value representing type of the visibleRate for the offer that is displayed to the user, either `PERCENT` or `FIXED`. Default is `UNKNOWN`

##### Returns

- The visible rate type of the served offer.

#### public int hashCode()
