Swift Module: Dispatch Queue

Swift Module: Dispatch Queue

by on ‎07-18-2018 02:32 PM - edited 2 weeks ago by (368 Views)

This module works in conjunction with the Connectivity module and the Consent Manager module to store any pending dispatches to disk while the device is offline or the user has not yet consented to tracking. When connectivity is restored, or if the user consents to tracking, the queue of dispatches will be sent. There is a default limit of 20 dispatches in the queue. When the limit is exceeded, the oldest dispatch will be cleared to make room for the most recent. Data is stored in UserDefaults.

In this article:

Table of Contents Placeholder

Supported Platforms

  • iOS
  • tvOS
  • watchOS
  • macOS

Installation

CocoaPods

  • Framework will be auto-instantiated if the pod is installed.
  • Depends on TealiumCore pod.
  • No additional import statements necessary other than import TealiumSwift.
    pod 'tealium-swift/TealiumDispatchQueue

Carthage

  • Framework will be auto-instantiated if it is compiled into your app (included in "Embedded Binaries").
  • Depends on TealiumCore.
  • No additional import statements necessary.
     TealiumDispatchQueue.framework

Recommended Usage

Usage of this module is required if using the Consent Manager or Connectivity modules. Otherwise, it is strongly recommended to aid with pre-init queueing of events by the TealiumCore module.

Included Variables

The following variable will be transmitted with each tracking call while the module is enabled:

Variable Name Description Example Value
was_queued Indicates that the dispatch was queued true

Public API

There are no public API methods for this module. Successes and failures may be monitored through the Delegate module.

TealiumConfig Methods

setMaxQueueSize

let config = TealiumConfig(account: "tealiummobile",
                profile: "demo",
                environment: "dev",
                datasource: "test12",
                optionalData: nil)
config.setMaxQueueSize(50)

Sets the maximum persistent queue size for dispatch storage. Default is 20 events.

getMaxQueueSize

let config = TealiumConfig(account: "tealiummobile",
                profile: "demo",
                environment: "dev",
                datasource: "test12",
                optionalData: nil)
config.setMaxQueueSize(50)

let queueSize: Int = config.getMaxQueueSize()

Gets the maxiumum queue size set on the TealiumConfig object.

Future Improvements

No planned changes

Change Log

Build 1

  • Initial release