Econda Tracking SDK

Installation

  • Drag and Drop the EcondaTracking_Swift.xcodeproj into the Project Navigator of your application’s Xcode project.
  • Select your Project in the Project Navigator
  • In Main View select your App-Target and General in the Top Bar
  • Scroll down to Linked Frameworks and Libraries and click the +-Button
  • Locate EcondaTracking_Swift.framework, select it and click the Add-Button

Usage

Prepare your AppDelegate

    import EcondaTracking_Swift

    lazy  var trackingSession:TrackingSession = {
        let clientKey = <#YOUR_CLIENT_KEY#>
        let session = TrackingSession(with: clientKey, secure: true, batchAutoTransmitTimeout: 10)
        session.samplingRate = 1
        session.set(loggingEnabled: true)
        return session
}()

Creating PageView and BasketItem

    // Create a new page view object
    let pageView  = TrackingPageView()

    pageView.add(content: "Tests/Testseite")
    pageView.add(search: "queryString", numberOfHits: 4)
    pageView.add(contact: "ContactData")
    pageView.add(download: "MyFile.zip")
    pageView.add(login: "uli", result: 0)
    pageView.add(orderProcess: "1_Warenkorb")
    pageView.add(register: "uli", result: 122)
    pageView.add(siteId: "myshop.de")
    pageView.add(countryId: "DE")
    pageView.add(langId: "DE")
    pageView.add(pageId: "Tests/Testseite")
    pageView.add(billing: "R-12345", customerID: "K-001", total: 300.0, country: "Germany", cip: "76131", city: "Karlsruhe")
    pageView.add(target: "product-info-download", additionalInfo:"example.pdf", score: 1.0, targetRule: .ETTargetRuleUseMonitorDefaultSettings)

    // Create a new basket item object and add it to the page view
    let basketItem = BasketItem(with: "P-1003",
                             productName: "ECONDA Monitor 5.000.000 PI",
                             price: 149.9,
                             productGroup: "EMOS/Shops/EMOS 5.000.000 PI",
                             quantity: 1,
                             variant1: "ECONDA",
                             variant2: "5.000.000",
                             variant3: "Shops")

    pageView.add(productView: basketItem)

Submit the PageView

    // Get reference to the tracking session from the application delegate
    let session = (UIApplication.shared.delegate as? AppDelegate)?.trackingSession

You can choose between three TransmitModes:

  • ETTransmitModeImmediatelyAsync
  • ETTransmitModeImmediatelySync
  • ETTransmitModeLaterBatch

The first two will immidiately transmit the data either in an synchronous or asynchronous way.

    session?.add(pageView: pageView, transmitMode: .ETTransmitModeImmediatelyAsync)

The latter will add the pageview to a batch which will transmiited after a certain time

    session?.add(pageView: pageView, transmitMode: .ETTransmitModeLaterBatch)

Doc generation with jazzy https://github.com/realm/jazzy

To update the code documentation, run the following shell script from within the project folder:

cd ./runJazzy.sh