Banner

Hierarchy

  • Banner

Index

Properties

html

html: string

HTML to display for the banner.

id

id: string

Analytics / tracking string.

isControl

isControl: boolean

Whether this banner is a control banner.

placementId

placementId: string

The placement ID this banner is matched to.

properties

properties: PropertiesJson

Properties of this object.

Avoid accessing these properties directly. Instead, prefer using the getStringProperty, getBooleanProperty, getNumberProperty, getImageProperty and getJsonProperty methods which ensure type safety and to avoid breaking changes in the future.

Methods

getBooleanProperty

  • getBooleanProperty(key: string): boolean | null
  • Get value of a property of type boolean.

    Parameters

    • key: string

      The key of the property.

    Returns boolean | null

    The value of the property if the key is found and is of type boolean. If the key is not found or if there is a type mismatch, this method will return a null.

getImageProperty

  • getImageProperty(key: string): string | null
  • Get value of a property of type image.

    Parameters

    • key: string

      The key of the property.

    Returns string | null

    The string value of the image url if the key is found and is of type image. If the key is not found or if there is a type mismatch, this method will return a null.

getJsonProperty

  • Get value of a property of type JSON.

    Parameters

    • key: string

      The key of the property.

    Returns JsonPropertyValue | null

    The value of the property if the key is found and is of type JSON. If the key is not found or if there is a type mismatch, this method will return a null.

getNumberProperty

  • getNumberProperty(key: string): number | null
  • Get value of a property of type number.

    Parameters

    • key: string

      The key of the property.

    Returns number | null

    The value of the property if the key is found and is of type number. If the key is not found or if there is a type mismatch, this method will return a null.

getStringProperty

  • getStringProperty(key: string): string | null
  • Get value of a property of type string.

    Parameters

    • key: string

      The key of the property.

    Returns string | null

    The value of the property if the key is found and is of type string. If the key is not found or if there is a type mismatch, this method will return a null.

getTimestampProperty

  • getTimestampProperty(key: string): number | null
  • Get value of a property of type datetime as a Unix timestamp (milliseconds).

    Parameters

    • key: string

      The key of the property.

    Returns number | null

    The Unix timestamp (milliseconds) value of the property if the key is found and is of type datetime. If the key is not found or if there is a type mismatch, this method will return a null.

removeAllSubscriptions

  • removeAllSubscriptions(): void
  • Remove all event subscriptions from this banner.

    Returns void

removeSubscription

  • removeSubscription(subscriptionGuid: string): void
  • Remove an event subscription that you previously subscribed to.

    Parameters

    • subscriptionGuid: string

      The identifier of the subscription you wish to remove, returned by the method you initially used to create it.

    Returns void

subscribeToDismissedEvent

  • subscribeToDismissedEvent(subscriber: () => void): string | null
  • Subscribe to receive dismissed events. The subscriber callback will be called whenever this banner is dismissed.

    Parameters

    • subscriber: () => void

      The callback function to receive dismissed events. This function will be invoked with no arguments when this banner records a dismissal.

        • (): void
        • Returns void

    Returns string | null

    The identifier of the subscription created. This can be passed to Banner.removeSubscription to cancel the subscription. Returns null if the subscriber passed is not a function.