Giter VIP home page Giter VIP logo

dmpclientpublic's Introduction

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. PageView function returns unique page and page view identifiers which represents calling page. Initialy, when the view controller is appeared, this function will return the identifiers. You must save that info on view controller to pass it to the sdk, when the controller is reappared.

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

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)

dmpclientpublic's People

Contributors

rashidium avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.