---
title: "Packages"
id: "packages"
project: "Contextual Commerce"
url: "https://docs.bazaarvoice.com/articles/contextual-commerce/packages"
updated: 2026-10-15T09:12:45Z
---

# Packages

###  

* [com.granifyinc.granifysdk](/articles/contextual-commerce/packages/a/h3_1688888765)
* [com.granifyinc.granifysdk.campaigns.inlineView](/articles/contextual-commerce/packages/a/h3_800044536)
* [com.granifyinc.granifysdk.compose](/articles/contextual-commerce/packages/a/h3__1176396113)
* [com.granifyinc.granifysdk.config](/articles/contextual-commerce/packages/a/h3__863044295)
* [com.granifyinc.granifysdk.helpers](/articles/contextual-commerce/packages/a/h3__644849704)
* [com.granifyinc.granifysdk.logging](/articles/contextual-commerce/packages/a/h3__1432647776)
* [com.granifyinc.granifysdk.models](/articles/contextual-commerce/packages/a/h3_2094446895)

###  com.granifyinc.granifysdk

#### Granify

Declaration:


```
object Granify

```
 
The entry point for all Contextual Commerce SDK API methods.

See more
 * * *
 
##### Functions 

`activateGranify`
 Activates the Contextual Commerce SDK and initiates communication with Contextual Commerce servers.
 
Placement:
 
This function must be called on app launch before any other API functions, except those that register callbacks (e.g. `subscribeGroupAssigned`, `subscribeMessageShown`, `subscribeErrorReporting`, and `registerGroupAssignmentProvider`).
 
Declaration:
 
```
@JvmStatic
fun activateGranify(configuration: GranifyConfiguration)

```
 
Parameters:

| `configuration` | The `GranifyConfiguration` object which contains all SDK configuration. |
| --- | --- |

`clearShopperId()`
 Clears the current shopper identifier.
 
Placement:
 
This function should be called whenever the current shopper identifier is no longer applicable, such as user log-out.
 
Declaration:
 
```
@JvmStatic
fun clearShopperId()

```


`overrideGranifyInlineView`
 Specifies a `GranifyInlineView` location in which to display inline widgets for testing purposes.
 
Placement:
 
Call this function when a user has manually entered an override string into a debug menu.
 
Declaration:
 
```
@JvmStatic
fun overrideGranifyInlineView(label: String?)

```
 
Parameters:

| `label` | A JSON object specifying the details of a `GranifyInlineViewLabel`<br> <br><br> <br>Example:<br> 
```
{"name": <GranifyInlineViewLabel.name>, "productId"(optional): <GranifyInlineViewLabel.productId>, "sku"(optional): <GranifyInlineViewLabel.sku>}

```
 |
| --- | --- |

`registerGroupAssignmentProvider`
 Register a callback provider for specifying group assignments when a new session is created.
 
In most cases, Contextual Commerce controls matching group assignments, but arrangements can be made with Contextual Commerce to control group assignments via this callback instead; thereby manually controlling the group split or delegating it to another provider. Permitted group values for your site may be a subset of those in the `MatchingGroup` enumeration, so work with your Account Manager to determine how to use this function for your specific needs.
 
Expect your `provider` callback to be invoked by Granify any time a request is made that may result in a new session. This will happen after the first `trackPageView` request is made and at arbitrary later points when starting a new session after expiry.

Expect your `provider` callback to be invoked by Granify at any time when active. No guarantees are made regarding the thread the `provider` will be invoked on.
 
Placement:
 
When in use, this function **must** be called prior to `activateGranify` on application launch.
 
Declaration:
 
```
@JvmStatic
fun registerGroupAssignmentProvider(provider: () -> MatchingGroup)

```
 
Parameters:

| `provider` | The callback function that provides the `MatchingGroup` for the session being initialized. |
| --- | --- |

`setChildSiteId`
 Notifies Contextual Commerce that the child site has changed.
 
In cases where a client has an app that uses multiple child sites (multiple brands), use this method when the shopper switches from one brand to another.
 
Placement:
 
This function should be called as soon as the child site (brand) in the app changes from the child site initially set in configuration, as well as any subsequent changes. If the brand changes because a new page is loaded, call this method immediately after the `Granify.trackPageView(...)` method, before `Granify.trackProduct(...)` or any other Granify call.
 
Declaration:
 
```
@JvmStatic
fun setChildSiteId(childSiteId: SiteIdentifier?)

```
 
Parameters:

| `childSiteId` | The site identifier for the child site. This should be Granify's identifier, which will be provided to you. |
| --- | --- |

`setCurrentProduct `
 Notifies Contextual Commerce which specific product on a product page is currently selected.
 
Placement:
 
This function should be called immediately after `trackProduct` and when the focused item is changed on a product page. This includes:

* On application launch to a product page (call with the default selected product sku).
* On application resume from background to a product page (call with the selected product sku when the view loads).
* From a navigation action leading to a product page (call with the default selected product sku).
* User action that changes the selected product sku on a product page.

Declaration:
 
```
@JvmStatic
fun setCurrentProduct(sku: String, productId: String)

```
 
Parameters:

| `sku` | The SKU of the currently selected product. Must match the ID field in one of the products called in `trackProduct`. |
| --- | --- |
| `productId` | The parent ID of the product. |

`setRestrictionState`
 Tells Contextual Commerce to enter/exit a restricted state in which no campaign can be shown to the shopper.

The initial state of the SDK is `UNRESTRICTED` upon activation.
 
Placement:
 
This function should be called:

* When entering a situation whereby a campaign should not be shown (excluding restricted page types).
* When exiting a situation whereby a campaign should not be shown (excluding navigating from restricted page types).

Declaration:
 
```
@JvmStatic
fun setRestrictionState(restrictionState: RestrictionState)

```
 
Parameters:

| `restrictionState` | The updated `RestrictionState` value indicating whether a campaign can be shown. |
| --- | --- |

`setShopperId`
 Notifies Contextual Commerce of the current customer's unique identifier.
 
This should be the same identifier you use in your store for your customers. It should not change if the same customer returns. If the shopper cannot be uniquely identified, this function should not be called.
 
Placement:
 
This function should be called as soon as the shopper's identifier is known. This may be:

* On application launch.
* After the shopper signs in to their account.

Declaration:
 
```
@JvmStatic
fun setShopperId(shopperId: String)

```
 
Parameters:

| `shopperId` | The unique identifier for the customer from your internal systems. This should remain the same for the customer on subsequent returns. |
| --- | --- |

`showCampaign `
 Requests that Contextual Commerce show the specified campaign (or message) within this session.
 
Once requested, the campaign matching `campaignId` will be shown at the next available opportunity. As campaigns are designed with various limitations around their presentation (e.g. only showing on a product page), the campaign may not appear immediately after this call is made.

It is a business review tool that grants the ability to see what a given Contextual Commerce campaign will look like within your application. Bazaarvoice strongly recommends creating an easy way for trusted users to trigger this function. This will simplify the previewing and testing of new campaigns as they become available.
 
The `campaignId` strings, used to request campaigns, can be obtained through your Account Manager.
 
Placement:
 
This function can be called any time after `activateGranify` has been called.
 
Declaration:
 
```
@JvmStatic
fun showCampaign(campaignId: String)

```
 
Parameters:

| `campaignId` | The id of the campaign to display. |
| --- | --- |

`subscribeErrorReporting`
 Registers a callback handler to be notified when the Contextual Commerce SDK has encountered an error it cannot resolve internally.
 
When the supplied `handler` is invoked, it indicates that the SDK is transitioning to an error state and will cease any further processing. Refer to the documentation of the provided `ErrorType` to determine the appropriate action to take. Some errors indicate incorrect API usage and require a code change, whereas others indicate runtime errors that may be handled with logic such as retrying an operation.
 
Expect your `handler` to be invoked by Granify at any time after `activateGranify` has been called. No guarantees are made regarding the thread the `handler` will be invoked on.
 
Placement:
 
This function can be called at any time, but it is most usefully called prior to `activateGranify` to ensure a handler is registered in advance of any errors occurring.
 
Declaration:
 
```
@JvmStatic
fun subscribeErrorReporting(handler: (ErrorType, String) -> Unit)

```
 
Parameters:

| `handler` | The callback to be invoked when an SDK error has occurred. An `ErrorType` will be supplied indicating the category of the error, and a message `String` providing additional human-readable context. |
| --- | --- |

`subscribeGroupAssigned `
 Registers a callback handler to be notified when a matching group has been assigned.
 
In most cases, the `handler` implementation is expected to send the group assignment information to your analytics system. This allows for tracking messaging eligibility as a metric across all sessions. A `Granify` (or similar) matching group is eligible to see messages whereas a `Baseline` (or similar) group is ineligible.
 
Expect your `handler` to be invoked by Granify when a new session is started. No guarantees are made regarding the thread the `handler` will be invoked on.
 
Placement:
 
This function can be called at any time, but it is most usefully called prior to `activateGranify` to ensure a handler is registered in advance of the group assignment taking place.
 
Usage:
 
The group that your handler receives when invoked is the exact group that should be reported in your analytics.

Declaration:
 
```
@JvmStatic
fun subscribeGroupAssigned(handler: (MatchingGroup) -> Unit)

```
 
Parameters:

| `handler` | The callback to be invoked when a group assignment has taken place. A `MatchingGroup` will be supplied indicating the group the shopper was assigned to for the session. |
| --- | --- |

`subscribeMessageShown`
 Registers a callback handler to be notified when a message is (or could have been) shown.
 
In most cases, this `handler` implementation is expected to send the display status information to your analytics system. This allows for tracking messages displayed (as determined by the Contextual Commerce engine) as a metric across all sessions.
 
Expect your `handler` to be invoked by Granify at any time, when our engine decides to show a message to a shopper. No guarantees are made regarding the thread the `handler` will be invoked on.
 
Placement:
 
This function can be called at any time, but it is most usefully called prior to `activateGranify` to ensure a handler is registered in advance of any messages being shown.
 
Declaration:
 
```
@JvmStatic
fun subscribeMessageShown(handler: (DisplayStatus) -> Unit)

```
 
Parameters:

| `handler` | The callback to be invoked when a message is shown. A `DisplayStatus` will be supplied indicating whether the shopper was shown the message. |
| --- | --- |

`trackCart `
 Notifies Contextual Commerce of the contents of the shopper's cart.
 
All cart information is required (rather than partial changesets) to sync the customer's cart with Contextual Commerce. Ensuring that this information is kept up to date is crucial to enable cart-related campaigns to work.
 
Placement:
 
This function should be called:

* On initial app launch.
* After there is any change made to the cart. This includes:
    * After a purchase is completed (to clear the cart); including through the use of a "Buy It Now" or other express purchase button.
    * The removal of an item.
    * Cart item quantity changes.
    * Updated cart information from a server response (e.g. from shopping performed on the same user account on a different device).

Declaration:
 
```
@JvmStatic
fun trackCart(items: Map)

```
 
Parameters:

| `items` | A map containing carted products as keys and corresponding cart quantities as values. |
| --- | --- |

`trackOrder `
 Notifies Contextual Commerce about completed purchases.
 
Placement:
 
Call this function after the order has been finalized and paid (for example, when the receipt page is displayed). The data provided to Granify must match the data provided to your analytics.
 
Declaration:
 
```
@JvmStatic
fun trackOrder(details: Order)

```
 
Parameters:

| `details` | An object containing the details of the completed order. |
| --- | --- |

`trackPageView `
 Tracks any changes to the active "page" or view that is displayed to the user in the application.
 
It is important to keep Contextual Commerce notified about the current page and the shopper's navigation through the app so that our engine can make appropriate decisions about what messages should be shown to which shoppers for maximum impact. This includes tracking what the user is currently viewing on the page via the use of scroll distance metrics which are inferred from the main scrollable view for the page.
 
Placement:
 
This function should be called:

* On application launch.
* On application resume from background.
* Each time a page navigation occurs.

It is recommended to call `trackPageView` in the `onResume` lifecycle callback of an Activity or `onResume` lifecycle callback of a Fragment. Contextual Commerce requires access to the current `FragmentActivity` at all times, so calling `trackPageView` from `onResume` ensures it is always available even when the activity is recreated due to a configuration change.
 ny modifications to the `Window.Callback` of an activity must be made before a trackPageView call; otherwise, Contextual Commerce will not be able to capture touch events.

Declaration:
 
```
@JvmOverloads
@JvmStatic
fun trackPageView(
pageIdentifier: PageIdentifier,
activity: FragmentActivity,
navigator: Navigator,
safeArea: () -> SliderMargins? = null,
scrollableView: ScrollableView? = null,
pageRestrictionState: RestrictionState = RestrictionState.UNRESTRICTED
)

```
 
Parameters:

| `pageIdentifier` | A `PageIdentifier` object containing the page type of the current page and its path. |
| --- | --- |
| `activity` | The current activity. Contextual Commerce requires the current activity for displaying campaign fragments and for capturing touch data. |
| `navigator` | Class implementing `Navigator`, providing functions to navigate to different pages within the application. |
| `safeArea` | A closure that returns `SliderMargins` where the margins given dictate the area where it is safe to draw a slider. This ensures a slider does not block app functionality such as navigation. If your app has a navbar displayed at the bottom of the activity, a sample `SliderMargins` to use is `SliderMargins(left: 0, top: 0, right: 0, bottom: navBar.height)`. The closure passed into this method will be invoked on the main thread whenever an orientation change of the device or an activity change occurs to allow the Contextual Commerce widgets to always use an up-to-date safe area for display. |
| `scrollableView` | The main `ScrollableView` on the page. These must be passed through the provided wrapper classes such as `ScrollViewWrapper`. |
| `pageRestrictionState` | a `RestrictionState` indicating whether or not the page is eligible to have a slider displayed on it. This parameter is not required, and defaults to `UNRESTRICTED`. |

`trackPageView` (Deprecated)
 Tracks any changes to the active "page" or view that is displayed to the user in the application.
 
It is important to keep Contextual Commerce notified about the current page and the shopper's navigation through the app so that our engine can make appropriate decisions about what messages should be shown to which shoppers for maximum impact. This includes tracking what the user is currently viewing on the page via the use of scroll distance metrics which are inferred from the main scrollable view for the page.
 
Deprecated:
 
Do not pass in safeArea as SliderMargins, safeArea should now be passed as a closure that returns SliderMargins.
 
Replace with:
 
```
Granify.trackPageView(
pageIdentifier: PageIdentifier,
activity: FragmentActivity,
navigator: Navigator,
safeArea: (() -> SliderMargins?)? = null,
scrollableView: ScrollableView? = null,
pageRestrictionState: RestrictionState = RestrictionState.UNRESTRICTED)

```
 
Placement:
 
This function should be called:

* On application launch.
* On application resume from background.
* Each time a page navigation occurs.

It is recommended to call `trackPageView` in the `onResume` lifecycle callback of an Activity or `onResume` lifecycle callback of a Fragment. Contextual Commerce requires access to the current `FragmentActivity` at all times, so calling `trackPageView` from `onResume` ensures it is always available even when the activity is recreated due to a configuration change.
 
Note that any modifications to the `Window.Callback` of an activity must be made before a trackPageView call; otherwise, Contextual Commerce will not be able to capture touch events.
 
Declaration:
 
```
@JvmStatic
fun trackPageView(
pageIdentifier: PageIdentifier, 
activity: FragmentActivity, 
navigator: Navigator, 
safeArea: SliderMargins? = null, 
scrollableView: ScrollableView? = null, 
pageRestrictionState: RestrictionState = RestrictionState.UNRESTRICTED
)

```
 
Parameters:

| `pageIdentifier` | A `PageIdentifier` object containing the page type of the current page and its path. |
| --- | --- |
| `activity` | The current activity. Granify requires the current activity for displaying campaign fragments and for capturing touch data. |
| `navigator` | Class implementing `Navigator`, providing functions to navigate to different pages within the application. |
| `scrollableView` | The main `ScrollableView` on the page. These must be passed through the provided wrapper classes such as `ScrollViewWrapper`. |
| `safeArea` | A `SliderMargins` where the margins given dictate the area where it is safe to draw a slider. This ensures a slider does not block app functionality such as navigation. If your app has a navbar displayed at the bottom of the activity, a sample `SliderMargins` to use is `SliderMargins(left: 0, top: 0, right: 0, bottom: navBar.height)`. |
| `pageRestrictionState` | a `RestrictionState` indicating whether or not the page is eligible to have a slider displayed on it. This parameter is not required, and defaults to `UNRESTRICTED`. |

`trackProduct `
 Notifies Contextual Commerce about the products available on a product page.
 
Supplied product information is cached in memory and may be used for the display of messages at a later point in time. All product variations (i.e. skus) on a page should be provided. For example, if a shirt has different colors or sizes, the product list provided should include an entry for every combination of shirt color and size.
 
Placement:
 
This function should be called after `trackPageView` when a product page is loaded:

* On application launch to a product page.
* On application resume from background (when resuming to a product page).
* From a navigation action leading to a product page.

Declaration:
 
```
@JvmStatic
fun trackProduct(products: List, carter: Carter)

```
 
Parameters:

| `products` | The list of all products featured on the product page. |
| --- | --- |
| `carter` | Class implementing `Carter`, providing functions to add items to the cart. |

`trackWishList(name:contents:)`
 Notifies Contextual Commerce of the contents of the shopper's wish list.
 
This method can be called multiple times for different lists you wish to track. Please ensure that you use a unique name for each list tracked (e.g. "Saved for Later", "Christmas", etc.) per user.
 
Placement:
 
This function should be called:

* On initial app launch.
* After there is any change made to the wish list.
* Upon updating wish list information from a server response (e.g. from shopping performed on the same user account on a different device).

Declaration:
 
```
@JvmStatic
fun trackWishList(name: String, contents: List)

```
 
Parameters:

| `name` | The name of the wish list being tracked. |
| --- | --- |
| `contents` | The contents of the wish list. |

### com.granifyinc.granifysdk.campaigns.inlineView

#### GranifyInlineView

Declaration:


```
class GranifyInlineView(activityContext: Context, attributeSet: AttributeSet?) : FrameLayout 

```
 
A view that an inline campaign can be displayed into. Handlers to expand and collapse the view must be provided so that inline views can be displayed.
 
Parameters:

| `activityContext` | The Context of the current activity. |
| --- | --- |
| `attributeSet` | A collection of attributes, as found associated with a tag in an XML document. This value may be null. |

See more
 * * *
 
#####  Functions 

`setCollapseHandler`
 Registers a handler that is used to collapse the `GranifyInlineView`. Expect this handler to be invoked anytime the `GranifyInlineView` is no longer needed to display. The Contextual Commerce SDK handles animation of the inlines internally.

Declaration:
 
```
fun setCollapseHandler(collapseHandler: GranifyInlineViewCollapser)

```


`setExpandHandler`
 Registers a handler that is used to expand the `GranifyInlineView`. Expect this handler to be invoked before an inline campaign is displayed. The `GranifyInlineView` will expand and the inline campaign will be displayed inside of it. The Contextual Commerce SDK handles animation of the inlines internally.

Declaration:
 
```
fun setExpandHandler(expandHandler: GranifyInlineViewExpander)

```


`setLabel`
 Installs a label that is used to uniquely identify this `GranifyInlineView`.
 
Declaration:
 
```
fun setLabel(label: GranifyInlineViewLabel)

```


####  GranifyInlineViewCollapser

Declaration:


```
typealias GranifyInlineViewCollapser = (GranifyInlineView, Int) -> Unit 

```
 
A handler that will collapse a `GranifyInlineView` so that it is no longer visible. This handler will be invoked when the `GranifyInlineView` is no longer needed to display. This handler is used in conjunction with animation, and is invoked on every render frame for the duration of the animation. As such, avoid including logs or metrics in this callback. Since: 2.0.0

####  GranifyInlineViewExpander

Declaration:

A handler that will expand a `GranifyInlineView` to a specified height. This handler will be invoked before an inline campaign is displayed, expanding the `GranifyInlineView` to the specified height. This handler is used in conjunction with animation, and is invoked on every render frame for the duration of the animation. As such, avoid including logs or metrics in this callback. Since: 1.7.0


```
typealias GranifyInlineViewExpander = (GranifyInlineView, Int) -> Unit

```
 
####  GranifyInlineViewLabel

Declaration:


```
@Serializable
data class GranifyInlineViewLabel(val name: String, val productId: String? = null, val sku: String? = null)

```
 
A label for a `GranifyInlineView` that identifies its location on the page. Since: 1.7.0

See more
 * * *
 
##### Constructors 

`GranifyInlineViewLabel`
 Declaration:
 
```
constructor(name: String, productId: String? = null, sku: String? = null)

```
 
Parameters:

| `name` | The name of this label location. If there are multiple `GranifyInlineViewLabel` on the page, then this parameter should be unique per-product. (e.g. You can have the name "aboveProduct" in different labels as long as they each have different `productId` and/or `sku` fields) |
| --- | --- |
| `productId` | The ID of the associated product. Required when the `GranifyInlineView` is located on a product page, or on any page where it is associated with a specific product (e.g. inlines associated with a cart product). |
| `sku` | Field that is required when the associated `GranifyInlineView` is associated with a specific productId/sku combination. The productId must be specified if the sku is set. |

Throws:

| `IllegalArgumentException` | If the sku is provided without a product ID. |
| --- | --- |
  
* * *
 
##### Properties 

`name`
 The name of this label location. If there are multiple `GranifyInlineViewLabel` on the page, then this parameter should be unique per-product. (e.g. You can have the name "aboveProduct" in different labels as long as they each have different `productId` and/or `sku` fields)
 
Declaration:
 
```
val name: String

```


`productId`
 The ID of the associated product. Required when the`GranifyInlineView` is located on a product page, or on any page where it is associated with a specific product (e.g. inlines associated with a cart product).
 
Declaration:
 
```
val productId: String? = null

```


`sku`
 Field that is required when the associated `GranifyInlineView` is associated with a specific productId/sku combination. The productId must be specified if the sku is set.
 
Declaration:
 
```
val sku: String? = null

```

  
* * *
 
#####  Functions 

`equals`
 Declaration:
 
```
open operator override fun equals(other: Any?): Boolean

```


####  GranifyInlineComposable

Declaration:


```
@Composable
fun GranifyInlineComposable(label: GranifyInlineViewLabel)

```
 
A composable view that an inline campaign can be displayed into. Since: 3.4.0

See more
 * * *
 
Parameters

| `label` | A label that is used to uniquely identify this `GranifyInlineComposable`. |
| --- | --- |

### com.granifyinc.granifysdk.compose

#### granifyLazyListScrollTrackingModifier

Declaration:


```
fun Modifier.granifyLazyListScrollTrackingModifier(state: LazyListState): Modifier

```
 
A custom modifier used by Granify to collect scroll statistics from a lazy list. Add this modifier to the top-level lazy list on list-based pages, such as cart or collection pages. Since: 3.4.0

Parameters:

| `state` | The state object for the associated LazyList. |
| --- | --- |

#### granifyVerticalScrollTrackingModifier

Declaration:


```
fun Modifier.granifyVerticalScrollTrackingModifier(scrollState: ScrollState): Modifier

```
 
A custom modifier used by Granify to collect scroll statistics from a page that uses a verticalScroll(or derived) modifier. Add this modifier to the top-level lazy list on list-based pages, such as cart or collection pages. Since: 3.4.0

Parameters:

| `scrollState` | The state object that tracks the scroll state of the associated composable. |
| --- | --- |

### com.granifyinc.granifysdk.config

#### GranifyConfiguration

Declaration:


```
data class GranifyConfiguration @JvmOverloads constructor(
val applicationContext: Context, 
val siteId: SiteIdentifier, 
val childSiteId: SiteIdentifier? = null, 
val codeVersion: String = "unknown"
)

```
 
The general configuration object used to gather all information needed to activate Contextual Commerce.

See more
 * * *
 
##### Constructors 

`GranifyConfiguration(...)`
 Declaration:
 
```
@JvmOverloads
constructor(
applicationContext: Context,
siteId: SiteIdentifier,
childSiteId: SiteIdentifier? = null,
codeVersion: String = "unknown"
)

```
 
Parameters:

| `applicationContext` | The application context. |
| --- | --- |
| `siteId` | The `SiteIdentifier` provided to you by your account executive. |
| `childSiteId` | The `SiteIdentifier` for the child site. This should be `null` in most cases. |
| `codeVersion` | The version string of your application code (e.g. "1.3.0"). |
  
* * *
 
##### Properties 

`applicationContext`
 The application context. This will be used to generate a preference file named 'Granify'.
 
Declaration:
 
```
val applicationContext: Context

```


`childSiteId`
 The 5-character (alpha-numeric, case sensitive) site identifier for the child site. This should be `null` in most cases. The exceptions are installs with parent and child sites; usually when a shared top-level domain exists across stores.
 
Declaration:
 
```
val childSiteId: SiteIdentifier? = null

```


`codeVersion`
 The version string of your application code. For example: `1.3.0` is a code version with `1` being the major version number, `3` being the minor, and `0` being the patch number.
 
Declaration:
 
```
val codeVersion: String = "unknown"

```


`siteId`
 The 5-character (alpha-numeric, case sensitive) site identifier provided to you by your account executive.
 
Declaration:
 
```
val siteId: SiteIdentifier

```


###  com.granifyinc.granifysdk.helpers

####  dataStore

Declaration:


```
val Context.dataStore: DataStore<Preferences>

```


###  com.granifyinc.granifysdk.logging

####  Level

Declaration:


```
enum class Level : Enum<Level>

```
 
Not intended for public use; this enum is exposed due to technical requirements but is not intended to be used externally. Do not interact with this enum or its constituents.
 
Properties:

See more
 * * *
 
##### Entries 

`DISABLED`
 Declaration:
 
```
case DISABLED

```


`DEBUG`
 Declaration:
 
```
case DEBUG

```


`INFO`
 Declaration:
 
```
case INFO

```


`CALL`
 Declaration:
 
```
case CALL

```


`WARN`
 Declaration:
 
```
case WARN

```


`ERROR`
 Declaration:
 
```
case ERROR

```


`CRITICAL`
 Declaration:
 
```
case CRITICAL

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): Level

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.
 
Declaration:
 
```
fun values(): Array<Level>

```

  
* * *
 
#####  Types 

`Companion`
 Declaration:
 
```
object Companion

```

  
* * *
 
#####  Properties 

`description`
 Declaration:
 
```
val description: String

```


`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<Level>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```


####  SdkLogger

Declaration:


```
object SdkLogger

```
 
Not intended for public use; this object and its methods are exposed due to technical requirements but are not intended to be used externally. Do not interact with this object or its constituents.

See more
 * * *
 
##### Functions 

`write`
 Not intended for public use; this method is exposed due to technical requirements but is not intended to be used externally. Do not call or otherwise interact with this method.
 
Declaration:
 
```
fun write(log: String, level: Level, source: LogSource)

```


####  LogSource

Declaration:


```
enum class LogSource : Enum<LogSource>

```
 
Not intended for public use; this enum and its methods are exposed due to technical requirements but are not intended to be used externally. Do not interact with this enum or its constituents.

See more
 * * *
 
##### Entries 

`ANDROID`
 Declaration:
 
```
case ANDROID

```


`REACT_NATIVE_ANDROID_MODULE`
 Declaration:
 
```
case REACT_NATIVE_ANDROID_MODULE

```


`REACT_NATIVE_TS_API`
 Declaration:
 
```
case REACT_NATIVE_TS_API

```

  
* * *
 
#####  Properties 

entries
  
Returns a representation of an immutable list of all enum entries, in the order they're declared.
  
```
val entries: EnumEntries<LogSource> ​

```
  

name
 
```
val name: String 

```
    

ordinal
 
```
val ordinal: Int 

```
  

`tag`
 Declaration:
 
```
val tag: String

```


`value`
 Declaration:
 
```
val value: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): LogSource

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<LogSource>

```


###  com.granifyinc.granifysdk.models

#### Carter

Declaration:


```
interface Carter

```
 
Defines callbacks that Contextual Commerce can call to add a product to the cart. Implement this interface using whatever mechanism your app requires to add a product to the cart. No guarantees are made regarding the thread the callbacks will be invoked on.

See more
 * * *
 
##### Functions 

`addCurrentProductToCart()`
 Adds the current product to the cart.
 
When invoked, the current product should be added to the cart or some indication should occur to notify the shopper of any selections that must first be made before the item can be added to the cart.

Declaration:
 
```
abstract fun addCurrentProductToCart()

```


####  Currency

Declaration:


```
enum class Currency : Enum<Currency>

```
 
Identifies a particular type of currency. Currently only USD is supported in this SDK. Talk to your Account Manager if you require additional currency options.

See more
 * * *
 
##### Entries 

`USD`
 United States Dollar.
 
Declaration:
 
```
case USD

```

  
* * *
 
#####  Properties 

`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<Currency>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): Currency

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<Currency>

```


####  DiscountCode

Declaration:


```
@Serializable
data class DiscountCode(val code: String, val amount: Price)

```
 
Represents an order discount code. Typically this is some coupon or promo code entered by the user to apply the discount to their order.

See more
 * * *
 
##### Constructors 

`DiscountCode(code:amount:)`
 Creates a `DiscountCode` instance.
 
Declaration:
 
```
constructor(code: String, amount: Price)

```
 
Parameters:

| `code` | The discount code string. |
| --- | --- |
| `amount` | The discounted amount. |
  
* * *
 
##### Properties 

`amount`
 The discounted amount.
 
Declaration:
 
```
val amount: Price

```


`code`
 The discount code string.
 
Declaration:
 
```
val code: String

```


####  DisplayStatus

Declaration:


```
enum class DisplayStatus : Enum<DisplayStatus>

```
 
Valid display status values that may be reported when the Granify engine decides to show a message to a shopper.

See more
 * * *
 
##### Entries 

`SHOWN`
 Indicates that the message was shown to the shopper.
 
Declaration:
 
```
case SHOWN

```


`NOT_SHOWN`
 Indicates that the message was not shown to the shopper.
 
Declaration:
 
```
case NOT_SHOWN

```

  
* * *
 
#####  Properties 

`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<DisplayStatus>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): DisplayStatus

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<DisplayStatus>

```


####  ErrorType

Declaration:


```
enum class ErrorType : Enum<ErrorType>

```
 
Types of errors that may be reported by the Contextual Commerce SDK.

See more
 * * *
 
##### Entries 

`SDK_ALREADY_ACTIVATED`
 Reported when attempting to initialize the SDK more than once with `activateGranify`.
 
A code change is required in the host application to fix errors of this type.
 
Declaration:
 
```
case SDK_ALREADY_ACTIVATED

```


`SDK_NOT_ACTIVATED`
 Reported when incorrectly using a method that requires `activateGranify` to first be called. Refer to method documentation in the `Granify` class to determine which methods require an activated SDK.
 
A code change is required in the host application to fix errors of this type.
 
Declaration:
 
```
case SDK_NOT_ACTIVATED

```


`SDK_SHUTDOWN`
 Reported when the SDK reaches a failure state. A failure state occurs when an unchecked error occurs in the SDK or when processing cannot be performed in soft real-time.
 
Declaration:
 
```
case SDK_SHUTDOWN

```


`CONFIGURATION_LOAD_FAILED`
 Reported when loading the application's configuration from the server failed. The configuration is loaded while processing a call to `activateGranify`.
 
This can be a transient error due to a network failure, so retrying Granify activation is allowed after a short delay.
 
Declaration:
 
```
case CONFIGURATION_LOAD_FAILED

```

  
* * *
 
#####  Properties 

`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<ErrorType>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): ErrorType

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<ErrorType>

```


####  MatchingGroup

Declaration:


```
enum class MatchingGroup : Enum<MatchingGroup>

```
 
Matching groups that a shopper may be assigned to. Note that Contextual Commerce configures each site to allow only certain matching groups to be used. Contact your account manager if you are uncertain which values are valid in your case.

See more
 * * *
 
##### Entries 

`BASELINE`
 Baseline group that will not be shown any message that the engine may match.
 
This uses the default (baseline) single-match engine.
 
Declaration:
 
```
case BASELINE

```


`GRANIFY`
 Active group that will be shown any single message that the engine may match.
 
This uses the default single-match engine.
 
Declaration:
 
```
case GRANIFY

```


`GRANIFY_B`
 Granify group 'B' used for A/B tests between two default groups on a site (alongside the GRANIFY group).
 
This uses the default single-match engine.
 
Declaration:
 
```
case GRANIFY_B

```


`BASELINE_B`
 Baseline group 'B' used for A/B tests between two default groups on a site (alongside the BASELINE group).
 
This uses the default (baseline) single-match engine.
 
Declaration:
 
```
case BASELINE_B

```


`GRANIFY_MULTI_MATCH`
 Active group that will be shown any messages the engine may match.
 
This uses the multi-match engine, utilizing the single-match engine but with a second layer running in tandem to allow for multi-match configured campaigns to show whenever they are matched.
 
Declaration:
 
```
case GRANIFY_MULTI_MATCH

```


`BASELINE_MULTI_MATCH`
 Baseline group that will not be shown any messages that the engine may match.
 
This uses the (baseline) multi-match engine, utilizing the single-match engine but with a second layer running in tandem to allow for multi-match configured campaigns to match at will.
 
Declaration:
 
```
case BASELINE_MULTI_MATCH

```


`GRANIFY_MULTI_MATCH_B`
 Granify multi-match group 'B' used for A/B tests between two multi-match groups on a site (alongside the GRANIFY\_MULTI\_MATCH group).
 
This uses the multi-match engine.
 
Declaration:
 
```
case GRANIFY_MULTI_MATCH_B

```


`BASELINE_MULTI_MATCH_B`
 Baseline multi-match group 'B' used for A/B tests between two multi-match groups on a site (alongside the BASELINE\_MULTI\_MATCH group).
 
This uses the (baseline) multi-match engine.
 
Declaration:
 
```
case BASELINE_MULTI_MATCH_B

```


`GRANIFY_PLATFORM`
 Active Granify platform group that will be shown any messages that the engine may match.
 
This uses the Granify platform engine, allowing multiple child engines to be configured per tool pair.
 
Declaration:
 
```
case GRANIFY_PLATFORM

```


`HOLDOUT_PLATFORM`
 Baseline Granify platform group that will not be shown any messages that the engine may match.
 
This uses the Contextual Commerce platform engine, allowing multiple child engines to be configured per tool pair. This matching group functions as a top-level holdout, so messages are not displayed even for eligible tool pairs.
 
Declaration:
 
```
case HOLDOUT_PLATFORM

```


`PAUSED_GRANIFY`
 Used to explicitly identify legacy traffic configured in rules to only match to 1-pixel test only during an active period. Group or matching pair can be used to filter paused traffic in reporting for billing and performance purposes.
 
Declaration:
 
```
case PAUSED_GRANIFY

```


`PAUSED_BASELINE`
 Used to explicitly identify legacy traffic configured in rules to only match to 1-pixel test only during an active period. Group or matching pair can be used to filter paused traffic in reporting for billing and performance purposes.
 
Declaration:
 
```
case PAUSED_BASELINE

```


`PREDICTIONS_FIRST_GRANIFY`
 A predictions first matching engine which allows ongoing predictions.
 
Declaration:
 
```
case PREDICTIONS_FIRST_GRANIFY

```


`PREDICTIONS_FIRST_BASELINE`
 A predictions first matching engine which allows ongoing predictions.
 
Declaration:
 
```
case PREDICTIONS_FIRST_BASELINE

```


`GRANIFY_MULTI_MATCH_V1`
 The same as GRANIFY\_MULTI\_MATCH but using an updated MultiMatch Engine.
 
Declaration:
 
```
case GRANIFY_MULTI_MATCH_V1

```


`BASELINE_MULTI_MATCH_V1`
 The same as BASELINE\_MULTI\_MATCH but using an updated MultiMatch Engine.
 
Declaration:
 
```
case BASELINE_MULTI_MATCH_V1

```


`GRANIFY_MULTI_MATCH_V2`
 This uses the updated multi-match engine, utilizing the predictions first single-match engine but with a second layer running in tandem to allow for multi-match configured campaigns to show whenever they are matched.
 
Declaration:
 
```
case GRANIFY_MULTI_MATCH_V2

```


`BASELINE_MULTI_MATCH_V2`
 This uses the (baseline) updated multi-match engine, utilizing the predictions first single-match engine but with a second layer running in tandem to allow for multi-match configured campaigns to match at will.
 
Declaration:
 
```
case BASELINE_MULTI_MATCH_V2

```


`GRANIFY_EVMAX_V01`
 This uses the EVMax V0.1 engine.
 
Declaration:
 
```
case GRANIFY_EVMAX_V01

```


`BASELINE_EVMAX_V01`
 This uses the (baseline) EVMax V0.1 engine.
 
Declaration:
 
```
case BASELINE_EVMAX_V01

```

  
* * *
 
#####  Properties 

`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<MatchingGroup>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): MatchingGroup

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<MatchingGroup>

```


####  Navigator

Declaration:


```
interface Navigator

```
 
Defines callbacks that Contextual Commerce can call to navigate to different pages within your application. These callbacks will be invoked when a user engages with the call-to-action on a Contextual Commerce campaign.

Implement this interface using whatever mechanism your app requires to navigate between views (e.g. intents, deep links, fragment transactions, etc.). No guarantees are made regarding the thread the callbacks will be invoked on.

See more
 * * *
 
##### Functions 

`navigateToCart()`
 Navigates from the current page to the cart.
 
Declaration:
 
```
abstract fun navigateToCart()

```


`navigateToProduct(productId:sku:)`
 Navigates from the current page to a product page.
 
Declaration:
 
```
abstract fun navigateToProduct(productId: String, sku: String?)

```
 
Parameters:

| `productId` | The parent ID of the product. |
| --- | --- |
| `sku` | The specific SKU of the product. |

#### Order

Declaration:


```
data class Order @JvmOverloads constructor(
val orderNumber: String, 
val lineItemsTotal: Price, 
val subtotal: Price, 
val totalTax: Price, 
val totalShipping: Price, 
val total: Price, 
val lineItems: HashMap<Product, Int>, 
val discountCodes: List<DiscountCode>, 
val financialStatus: String = defaultFinancialStatus, 
val currency: Currency = Currency.USD
)

```
 
Represents an order placed on the site.

See more
 * * *
 
##### Constructors 

`Order`
 Creates an Order instance with all the required order details.
 
Declaration:
 
```
@JvmOverloads
constructor(
orderNumber: String,
lineItemsTotal: Price,
subtotal: Price,
totalTax: Price,
totalShipping: Price,
total: Price,
lineItems: HashMap<Product, Int>,
discountCodes: List<DiscountCode>,
financialStatus: String = defaultFinancialStatus,
currency: Currency = Currency.USD
)

```
 
Parameters:

| `orderNumber` | The unique identifier for this order. |
| --- | --- |
| `lineItemsTotal` | The total value of all items in the cart before any discounts, taxes, and shipping, but after sale pricing. |
| `subtotal` | The total value of the items in the order after discounts but before shipping or taxes. This should match the order total you use in your own analytics. |
| `totalTax` | The total value of any taxes applied to this order. |
| `totalShipping` | The total value of any shipping costs applied to this order. |
| `total` | The total value of the order (after discounts) including shipping and taxes. |
| `lineItems` | The products in the order and their corresponding ordered quantities. |
| `discountCodes` | A list of discounts applied to this order. If no discounts are applicable, this must be an empty list. |
| `financialStatus` | The payment status of the order. Use the provided parameter default ("paid") unless you want to send information about fraud or cancelled orders. |
| `currency` | The local currency used for prices. |
  
* * *
 
##### Properties 

`currency`
 The local currency used for prices.
 
Declaration:
 
```
val currency: Currency

```


`discountCodes`
 A list of discounts applied to this order.
 
Declaration:
 
```
val discountCodes: List<DiscountCode>

```


`financialStatus`
 The payment status of the order.
 
Declaration:
 
```
val financialStatus: String

```


`lineItems`
 The products in the order and their corresponding ordered quantities.
 
Declaration:
 
```
val lineItems: HashMap<Product, Int>

```


`lineItemsTotal`
 The total value of all items in the cart before any discounts, taxes, and shipping, but after sale pricing.
 
Declaration:
 
```
val lineItemsTotal: Price

```


`orderNumber`
 The unique identifier for this order.
 
Declaration:
 
```
val orderNumber: String

```


`subtotal`
 The total value of the items in the order after discounts but before shipping or taxes.
 
Declaration:
 
```
val subtotal: Price

```


`total`
 The total value of the order (after discounts) including shipping and taxes.
 
Declaration:
 
```
val total: Price

```


`totalShipping`
 The total value of any shipping costs applied to this order.
 
Declaration:
 
```
val totalShipping: Price

```


`totalTax`
 The total value of any taxes applied to this order.
 
Declaration:
 
```
val totalTax: Price

```


####  PageIdentifier

Declaration:


```
class PageIdentifier(val pageType: PageType, val path: String)

```
 
Contains information about a page's type and its unique path.

See more
 * * *
 
##### Constructors 

`PageIdentifier`
 Declaration:
 
```
constructor(pageType: PageType, path: String)

```
 
Parameters:

| `pageType` | The `PageType` of the current page. |
| --- | --- |
| `path` | The unique path for the page. This must be the same value each time this page is visited. For example, a product page path could be a string containing the parent collection and the product id. |
  
* * *
 
##### Properties 

`pageType`
 Declaration:
 
```
val pageType: PageType

```


`path`
 Declaration:
 
```
val path: String

```

  
* * *
 
#####  Functions 

`toString`
 Declaration:
 
```
open override fun toString(): String

```


####  Price

Declaration:


```
@Serializable
open class Price

```
 
Represents a non-negative monetary price value. This should match the currency used for prices in your analytics. Must be USD, unless another currency has been agreed on with Bazaarvoice. All prices used in a single API call must use a singular currency.

See more
 * * *
 
##### Constructors 

`Price`
 Declaration:
 
```
@JvmOverloads
constructor(amount: Double, currency: Currency = Currency.USD)

```
 
Parameters:

| `amount` | The magnitude of the price. |
| --- | --- |
| `currency` | The currency associated with the amount. |
 
Throws:

| `IllegalArgumentException` | When amount is negative. |
| --- | --- |

* * *
 
##### Properties 

`amount`
 The magnitude of the price.
 
Declaration:
 
```
val amount: Double

```


`currency`
 The currency associated with the amount.
 
Declaration:
 
```
val currency: Currency

```

  
* * *
 
#####  Functions 

`toString`
 Returns a string representation of the price.
 
Declaration:
 
```
open override fun toString(): String

```


####  PageType

Declaration:


```
@Serializable
enum class PageType : Enum<PageType>

```
 
Page type values that represent different types of pages that may be present in an application.

See more
 * * *
 
##### Types 

Companion
 
```
object Companion 

```
  

#####  Entries 

`HOME`
 The home page for the application.
 
Declaration:
 
```
case HOME

```


`PRODUCT`
 A page listing a single product (sometimes with multiple sku variations).
 
Declaration:
 
```
case PRODUCT

```


`COLLECTION`
 A page containing a collection of products. Often, this is a page listing some category of products.
 
Declaration:
 
```
case COLLECTION

```


`SEARCH`
 A page containing search results.
 
Declaration:
 
```
case SEARCH

```


`BLOG`
 A page containing supporting blog content or articles.
 
Declaration:
 
```
case BLOG

```


`CART`
 The cart page for a store, listing the user's current cart contents, and often the entry point for a checkout.
 
Declaration:
 
```
case CART

```


`CHECKOUT`
 The checkout page allowing a user to complete the checkout process.
 
Declaration:
 
```
case CHECKOUT

```


`FLIGHTS`
 Pages containing listings of flight options (intended for use by flight-booking applications).
 
Declaration:
 
```
case FLIGHTS

```


`ACCOUNT`
 Pages relating to the shopper's account.
 
Declaration:
 
```
case ACCOUNT

```


`LOGIN`
 The shopper login page.
 
Declaration:
 
```
case LOGIN

```


`INFO`
 Informational pages about the application (e.g. an "About" page).
 
Declaration:
 
```
case INFO

```


`GUIDE`
 Pages containing guidance information for shoppers.
 
Declaration:
 
```
case GUIDE

```


`VIDEO`
 Video content pages on the application.
 
Declaration:
 
```
case VIDEO

```


`OTHER`
 All pages that do not fit into any of the other page types categories should be classified as OTHER.
 
Declaration:
 
```
case OTHER

```


`RECEIPT`
 The receipt page shown after completing the checkout process.
 
Declaration:
 
```
case RECEIPT

```


`WISHLIST`
 A page containing the customer's list of personally archived items.
 
Declaration:
 
```
case WISHLIST

```

  
* * *
 
#####  Properties 

`description`
 The canonical string representation for the page type.
 
Declaration:
 
```
val description: String

```


`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<PageType>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): PageType

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<PageType>

```


####  Product

Declaration:


```
data class Product(
val sku: String, 
val productId: String, 
val title: String, 
val price: Price, 
val regularPrice: Price, 
val image: URL? = null, 
val stock: ProductStock? = null, 
val reviews: ProductReviews? = null, 
val category: String? = null, 
val subCategory: String? = null, 
val color: String? = null, 
val size: String? = null, 
val childSiteOwnerId: SiteIdentifier? = null, 
val customProperties: Map<String, StringOrInt> = mapOf()
)

```
 
Represents a distinct product with basic identifiers, price, display information, and further optional detailed information.

See more
 * * *
 
##### Constructors 

`Product  `
 Declaration:
 
```
constructor(
sku: String,
productId: String,
title: String,
price: Price,
regularPrice: Price,
image: URL? = null,
stock: ProductStock? = null,
reviews: ProductReviews? = null,
category: String? = null,
subCategory: String? = null,
color: String? = null,
size: String? = null,
childSiteOwnerId: SiteIdentifier? = null,
customProperties: Map<String, StringOrInt> = mapOf()
)

```
 
Parameters:

| `sku` | The specific SKU of the product/variant. |
| --- | --- |
| `productId` | The parent ID of the product. |
| `title` | The name or title of the product. |
| `price` | The current unit price of the product (after discount or sale pricing). |
| `regularPrice` | The regular price of the product before sales or discounts. |
| `image` | The address of the product image. If supplied, must use HTTPS (optional). |
| `stock` | The stock information for the product (optional). |
| `reviews` | The review and rating information for the product (optional). |
| `category` | The broad category containing this item (optional). |
| `subCategory` | Further categorical identification for the item (optional). |
| `color` | The color of the SKU item (optional). |
| `size` | The size of the SKU item (optional). |
| `childSiteOwnerId` | The site id of the child site this product belongs to. Leave this null unless your configuration uses child sites, in which case this value is required (optional). |
| `customProperties` | Named (keys) custom properties (values with a valid string or integer representation) to be stored and reported to Contextual Commerce with the product. This is useful for adding additional properties that may be domain-specific to your site and do not fit into any of the existing properties available on this class. |
  
* * *
 
##### Properties 

`category`
 The broad category containing this item (optional).
 
Declaration:
 
```
val category: String? = null

```


`childSiteOwnerId`
 The site id of the child site this product belongs to. Leave this null unless your configuration uses child sites, in which case this value is required (optional).
 
Declaration:
 
```
val childSiteOwnerId: SiteIdentifier? = null

```


`color`
 The color of the SKU item (optional).
 
Declaration:
 
```
val color: String? = null

```


`customProperties`
 Named (keys) custom properties (values with a valid string or integer representation) to be stored and reported to Contextual Commerce with the product. This is useful for adding additional properties that may be domain-specific to your site and do not fit into any of the existing properties available on this class.
 
Declaration:
 
```
val customProperties: Map<String, StringOrInt>

```


`image`
 The address of the product image. If supplied, must use HTTPS. (optional).
 
Declaration:
 
```
val image: URL? = null

```


`price`
 The current unit price of the product (after discount or sale pricing).
 
Declaration:
 
```
val price: Price

```


`productId`
 The parent ID of the product.
 
Declaration:
 
```
val productId: String

```


`regularPrice`
 The regular price of the product before sales or discounts.
 
Declaration:
 
```
val regularPrice: Price

```


`reviews`
 The review and rating information for the product (optional).
 
Declaration:
 
```
val reviews: ProductReviews? = null

```


`size`
 The size of the SKU item (optional).
 
Declaration:
 
```
val size: String? = null

```


`sku`
 The specific SKU of the product/variant.
 
Declaration:
 
```
val sku: String

```


`stock`
 The stock information for the product (optional).
 
Declaration:
 
```
val stock: ProductStock? = null

```


`subCategory`
 Further categorical identification for the item (optional).
 
Declaration:
 
```
val subCategory: String? = null

```


`title`
 The name or title of the product.
 
Declaration:
 
```
val title: String

```


####  ProductStock

Declaration:


```
data class ProductStock(val count: Int)

```
 
Contains product stock information.

See more
 * * *
 
##### Constructors 

`ProductStock(count:)`
 Creates a `ProductStock` instance.
 
Declaration:
 
```
constructor(count: Int)

```
 
Parameters:

| `count` | The amount of product in stock. |
| --- | --- |
  
* * *
 
##### Properties 

`count`
 The amount of product in stock.
 
Declaration:
 
```
val count: Int

```

  
* * *
 
#####  Functions 

`inStock`
 Queries whether the product is currently in stock.
 
Return:
 `true` if the product stock count is greater than 0 and `false` otherwise.
 
Declaration:
 
```
fun inStock(): Boolean

```


####  ProductReviews

Declaration:


```
open class ProductReviews

```
 
Contains product review and rating information.

See more
 * * *
 
##### Constructors 

`ProductReviews`
 Declaration:
 
```
constructor(rating: Double?, ratingScale: Range<Double>?, reviewCount: UInt?)

```
 
Throws:

| `IllegalArgumentException` | If the rating is outside of the ratingScale |
| --- | --- |

Parameters:

| `rating` | The product rating. |
| --- | --- |
| `ratingScale` | The allowable rating range. |
| `reviewCount` | The number of reviews. |
  
* * *
 
##### Properties 

`rating`
 The product rating.
 
Declaration:
 
```
val rating: Double?

```


`ratingScale`
 The allowable rating range.
 
Declaration:
 
```
val ratingScale: Range<Double>?

```


`reviewCount`
 The number of reviews.
 
Declaration:
 
```
val reviewCount: UInt?

```

  
* * *
 
#####  Functions 

`toString`
 Declaration:
 
```
open override fun toString(): String

```


####  RestrictionState

Declaration:


```
enum class RestrictionState : Enum<RestrictionState>

```
 
Restriction state values that control whether or not campaigns can be displayed.

See more
 * * *
 
##### Entries 

`RESTRICTED`
 Indicates that Granify is restricted from showing campaigns.
 
Declaration:
 
```
case RESTRICTED

```


`UNRESTRICTED`
 Indicates that Granify is allowed to show campaigns.
 
Declaration:
 
```
case UNRESTRICTED

```

  
* * *
 
#####  Properties 

`entries`
 Returns a representation of an immutable list of all enum entries, in the order they're declared.
 
Declaration:
 
```
val entries: EnumEntries<RestrictionState>

```


`name`
 Declaration:
 
```
val name: String

```


`ordinal`
 Declaration:
 
```
val ordinal: Int

```

  
* * *
 
#####  Functions 

`valueOf`
 Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
 
Declaration:
 
```
fun valueOf(value: String): RestrictionState

```
 
Parameters:

| `value` | The name of the enum constant to be returned. |
| --- | --- |

`values`
 Returns an array containing the constants of this enum type, in the order they're declared.
 
Declaration:
 
```
fun values(): Array<RestrictionState>

```


####  ScrollableView

Declaration:


```
sealed class ScrollableView : Scrollable

```
 
A view that is scrollable.

At present this is only compatible with a [ScrollView](https://developer.android.com/reference/kotlin/android/widget/ScrollView.html).

Inheritors:

ScrollViewWrapper

See more
 * * *
 
##### Types 

`ScrollViewWrapper`
 Wrapper for a ScrollView.
 
Declaration:
 
```
class ScrollViewWrapper(scrollView: ScrollView) : ScrollableView

```
 
Properties:

| `scrollDepth` | abstract val scrollDepth: Double |
| --- | --- |
| `scrollTop` | abstract val scrollTop: Int |

#### 

####  

#### 

####  

####  

#### WishListItem

Declaration:


```
data class WishListItem(
val productId: String, 
val inStock: Boolean, 
val sku: String? = null, 
val price: Price? = null, 
val regularPrice: Price? = null, 
val title: String? = null, 
val image: URL? = null, 
val dateAdded: Date? = null, 
val priceWhenAdded: Price? = null
)

```
 
Represents a product within a wish list.

See more
 * * *
 
##### Constructors 

`WishListItem`
 Initializes a `WishListItem` instance.
 
Declaration:
 
```
abstract class ScrollableView 


@JvmOverloads


constructor(product: Product, dateAdded: Date? = null, priceWhenAdded: Price? = null)​

```
 
 
```
constructor(
productId: String,
inStock: Boolean,
sku: String? = null,
price: Price? = null,
regularPrice: Price? = null,
title: String? = null,
image: URL? = null,
dateAdded: Date? = null,
priceWhenAdded: Price? = null
)

```
 
Parameters:

| `productId` | The parent ID of the product. |
| --- | --- |
| `inStock` | Whether the item is currently in stock. |
| `sku` | The specific SKU of the product/variant (optional). |
| `price` | The current unit price of the product after discount or sale pricing (optional). |
| `regularPrice` | The regular price of the product before sales or discounts (optional). |
| `title` | The name or title of the product (optional). |
| `image` | The address of the product image (optional). |
| `dateAdded` | The date the item was added to the wish list (optional). |
| `priceWhenAdded` | The price of the product when it was added to the wish list (optional). |
 
Throws:

| `IllegalArgumentException` | When product stock is null. |
| --- | --- |

* * *
 
##### Properties 

`dateAdded`
 The date the item was added to the wish list (optional).
 
Declaration:
 
```
val dateAdded: Date? = null

```


`image`
 The address of the product image (optional).
 
Declaration:
 
```
val image: URL? = null

```


`inStock`
 Whether the item is currently in stock.
 
Declaration:
 
```
val inStock: Boolean

```


`price`
 The current unit price of the product after discount or sale pricing (optional).
 
Declaration:
 
```
val price: Price? = null

```


`priceWhenAdded`
 The price of the product when it was added to the wish list (optional).
 
Declaration:
 
```
val priceWhenAdded: Price? = null

```


`productId`
 The parent ID of the product.
 
Declaration:
 
```
val productId: String

```


`regularPrice`
 The regular price of the product before sales or discounts (optional).
 
Declaration:
 
```
val regularPrice: Price? = null

```


`sku`
 The specific SKU of the product/variant (optional).
 
Declaration:
 
```
val sku: String? = null

```


`title`
 The name or title of the product (optional).
 
Declaration:
 
```
val title: String? = null

```


####  StringOrInt

Declaration:


```
@Serializable(with = StringOrIntSerializer::class) 


sealed class StringOrInt​

```
 

Discriminated union type for a [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-string/index.html) or [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html) for use in Product.customProperties.

Holds a [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-string/index.html) or an [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), but not both.

See more
 * * *
 
##### Inheritors 

`IntWrapper`
 A wrapper around an `Int`.
 
Declaration:
 
```
class IntWrapper(val int: Int) : StringOrInt

```


`StringWrapper`
 A wrapper around a `String`.
 
Declaration:
 
```
class StringWrapper(val string: String) : StringOrInt

```


####  SliderMargins

Declaration:


```
class SliderMargins(val left: Int, val top: Int, val right: Int, val bottom: Int) : Parcelable

```
 
Defines safe areas or margins around a slider, ensuring it does not overlap with other UI elements.

See more
 * * *
 
##### Constructors 

`SliderMargins`
 Creates a `SliderMargins` instance.
 
Declaration:
 
```
constructor(top: Int, bottom: Int, right: Int, left: Int)

```
 
```
constructor(parcel: Parcel) 

```
 
Parameters:

| `top` | Distance in pixels from the top of the screen that a slider should not occupy. |
| --- | --- |
| `bottom` | Distance in pixels from the bottom of the screen that a slider should not occupy. |
| `right` | Distance in pixels from the right side of the screen that a slider should not occupy. |
| `left` | Distance in pixels from the left side of the screen that a slider should not occupy. |
  
* * *
 
##### Properties 

`bottom`
 Distance in pixels from the bottom of the screen that a slider should not occupy.
 
Declaration:
 
```
val bottom: Int

```


`left`
 Distance in pixels from the left side of the screen that a slider should not occupy.
 
Declaration:
 
```
val left: Int

```


`right`
 Distance in pixels from the right side of the screen that a slider should not occupy.
 
Declaration:
 
```
val right: Int

```


`top`
 Distance in pixels from the top of the screen that a slider should not occupy.
 
Declaration:
 
```
val top: Int

```


####  SiteIdentifier

Declaration:


```
@Serializable(with = SiteIdentifierSerializer::class) 


class SiteIdentifier​

```
 
A wrapper for the site ID string to ensure type safety.

See more
 * * *
 
##### Constructors 

`SiteIdentifier`
 Creates a SiteIdentifier from the underlying identifier string. Note that this string is case-sensitive.
 
Declaration:
 
```
constructor(identifier: String)

```
 
Throws:

| `IllegalArgumentException` | If identifier is not a 5-character alphanumeric string. |
| --- | --- |
  
* * *
 
#####  
 
* * *
 
##### Functions 

`toString()`
 Declaration:
 
```
open override fun toString(): String

```


[![Provide feedback button](/resources/Storage/contextual-commerce/bv-global/topic-footer-2026/provide-feedback-button.png)](https://docs.google.com/forms/d/1qGZ5rApqDrXO_j6vNzcDihDAOPMEjmUr1alHvcEIbQU/edit)