Swiftpack.co - brainsland/DMPiOSClientPublic as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by brainsland.
brainsland/DMPiOSClientPublic 1.1.0
DMP iOS Client
⭐️ 0
🕓 5 days ago
iOS
.package(url: "https://github.com/brainsland/DMPiOSClientPublic.git", from: "1.1.0")

DMPClient

DMPClient iOS SDK

Installation

Swift Package Manager

DMPClient supports installation through SPM:

https://github.com/brainsland/DMPiOSClientPublic.git

Manually

You can download and embed the framework manually.

Setup

Firstly, you need to configure DMPClient SDK by calling setup when the app is started, ideally at AppDelegate's didFinishLaunchingWithOptions function:

let url = URL(string: "https://backend.com/api")!
DMP.shared.setup(projectId: "usertest", url: url, language: "tr")

Logging

You can enable developer mode to get detailed logs from SDK.

DMP.shared.enableLogging(true)

Tracking

SDK collects most of data automatically, like sent time, timezone, session identifier. Tracking requests through DMP.shared instance are explained below. Any view controller that use tracking, must call pageView function on its viewDidAppear function as explained below. This way, SDK can track page durations automatically and reuse page identifiers.

Page View

Any page that is needed to be tracked, should use pageView function. When the view controller is appeared, this function should be called.

class ViewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        let request = PageViewRequest(
            url: "https://example.com/", canonicalUrl: "", title: "", referrer: "r", infiniteScrollDepth: 0
        )
        DMP.shared.pageView(request)
    }
}

Page Duration

Page durations are tracked through pageView requests automatically through saved PageViewInfo. Implementing pageView mentioned above will be enough to get necessary functionality.

Breadcrumb

DMP.shared.breadcrumb(breadcrumb1: "b1", breadcrumb2: "b2", breadcrumb3: "b3", breadcrumb4: "b4", breadcrumb5: "b5")

Scroll Position

DMP.shared.scrollPosition(12)

Track Zone

DMP.shared.trackZone(type: "z1", value: "v1")

Track User

DMP.shared.trackUser(type: "u_gold", id: "123")

Page Event

DMP.shared.pageEvent(category: "c", action: "a", label: "l", value: "v")

Article

let request = NewsArticleRequest(
    newsUrl: "", headline: "", description: "d", section: "s",
    author1: "a1", author2: "", author3: "", image1: "i1", image2: "", image3: "",
    keywords: "ss,ss", info: "info", datePublished: "", dateModified: "", wordCount: 3
)
DMP.shared.newsArticle(request)

GitHub

link
Stars: 0
Last commit: 5 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v1.1.0
5 days ago

Deprecate pageView(pageView:info:) and add pageView(pageView:) instead.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics