Rokt Documentation
  • Documentation
  • User Guide
  • SDK
  • API
  • Third-Party Integrations
  • Help

›Interfaces

Getting Started

  • Introduction

Web SDK

  • Overview
  • Architecture
  • Integrating the Web SDK
  • Integration Examples

    • Confirmation Page Integration
    • Preparative Iframe
    • Page Identifier
    • Single Page Applications
    • Brand Conversion Integration
    • In Transaction/Cart Integration
    • Event-based Integration
    • Sandbox Integration
  • Integration Best Practices
  • Attributes
  • Security
  • Mobile In-App Web Pages
  • API

    • README
    • Globals

    Enumerations

    • FailureReason

    Interfaces

    • Attributes
    • Cart
    • CartItem
    • PlacementCloseEvent
    • Rokt
    • RoktConfiguration
    • Widget

iOS SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration
  • Attributes
  • Security

Android SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security

React Native SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security
Edit

Rokt

This object provides the entry point to integrate with Rokt solutions.

Properties

cart

• cart: Cart

Provides access to cart integration

see Cart


version

• version: string

Rokt JavaScript API version.


widget

• widget: Widget

Provides access to widget integration

see Widget

Methods

closeAll

▸ closeAll(): void

Close/Unload all placements on the page

Returns: void


init

▸ init(configuration: RoktConfiguration): void

Sets information allowing to identify you or your consumer.

see RoktConfiguration on details of available parameters.

Parameters:

NameTypeDescription
configurationRoktConfigurationConfiguration object

Returns: void


onFailure

▸ onFailure(failureCallback: OnFailureCallback): void

Accepts a callback which will be triggered when Rokt object fails to load/cannot be displayed correctly. For example, this scenario can happen when encountering very old browser that is not supported by Rokt as per agreement with client.

example

rokt.onFailure((reason) => {
  // Use this hook to display error or navigate to another page
});

Parameters:

NameTypeDescription
failureCallbackOnFailureCallbackCallback to be triggered when Rokt object is ready

Returns: void


onLoaded

▸ onLoaded(onLoadedCallback: function): void

Accepts a callback which will be triggered once Rokt object has been loaded and is ready to use. Callback will be triggered immediately if Rokt object is already ready.

You can invoke this method multiple times each time passing a unique callback. They will be all executed in the order they were passed once Rokt object is ready to integrate. This approach may be useful in case of Single Page Applications in which integration points may happen in multiple places in the JavaScript code.

example

rokt.onLoaded((rokt) => {
  // Now you can interact with Rokt object
});

Parameters:

▪ onLoadedCallback: function

Callback to be triggered when Rokt object has been loaded

▸ (rokt: Rokt): void

Parameters:

NameType
roktRokt

Returns: void


setAttributes

▸ setAttributes(attributes: Attributes): void

Sets attributes which allow Rokt to better tailor offer to a consumer. Those attributes may include consumer email, first name, last name, etc. Depending on your catalog provider, additional information may be required by Rokt to be able to retrieve catalog items, e.g. for ticketing partners eventId is required.

Rokt.setAttributes performs a shallow merge of passed attributes into the existing attributes.

Since passing browser's user agent is required attributes store its value under userAgent property by default.

default

{
  userAgent: 'Mozilla/5.0 (...)', // window.navigator.userAgent value
}

Parameters:

NameTypeDescription
attributesAttributesDictionary with data such as first name, last name, email, etc.

Returns: void


setFulfillmentAttributes

▸ setFulfillmentAttributes(attributes: Attributes): void

Sets attributes that remains unknown by Rokt until the user accepts any of the offers.

Rokt.setFulfillmentAttributes performs a shallow merge of passed attributes into the existing attributes.

Parameters:

NameTypeDescription
attributesAttributesDictionary with data such as first name, last name, email, etc.

Returns: void

← PlacementCloseEventRoktConfiguration →
  • Properties
    • cart
    • version
    • widget
  • Methods
    • closeAll
    • init
    • onFailure
    • onLoaded
    • setAttributes
    • setFulfillmentAttributes
RESOURCES
DocumentationUser GuideSDKAPIIntegration PartnersHelp
COMPANY
About UsContact UsCareersEngineering Blog
Rokt Documentation
Copyright © Rokt 2021 - All Rights Reserved