Latest 0.0.2
Homepage https://github.com/audienceproject/userreport-ios-sdk
License Apache License, Version 2.0
Platforms ios 9.0, requires ARC
Frameworks Foundation, UIKit, WebKit, AdSupport

architecture overview

CocoaPods Compatible
Platform
Xcode 9.0
iOS 9.0+
Swift 4.0
License

Requirements

  • Xcode 9.0+
  • iOS 9.0+

Installation

UserReport iOS SDK can be installed in various ways.

CocoaPods

CocoaPods is a centralized dependency manager for
Objective-C and Swift. Go here
to learn more.

  1. Add the project to your Podfile.

    use_frameworks!
    
    pod 'UserReport'
  2. Run pod install and open the .xcworkspace file to launch Xcode.
  3. Import the UserReport framework.

    import UserReport

Manually

To install it manually drag the UserReport project into your app project in Xcode or add it as a git submodule.
In your project folder enter:

$ git submodule add [email protected]:AudienceProject/userreport-ios-sdk.git

Usage

Configure

Configure UserReport iOS SDK via SAK_ID, MEDIA_ID (You can find these values on media setting page) and information about user.

// Create user object
let user = User()
user.email = "[email protected]"

// You can also specify a email hash
user.emailMd5 = "MD5_EMAIL_HASH"
user.emailSha1 = "SHA1_EMAIL_HASH"
user.emailSha256 = "SHA256_EMAIL_HASH"

// Provide additional social network information
user.facebookId = "FACEBOOK_ID"

// Configure
UserReport.configure(sakId: "YOUR_SAK_ID", mediaId: "YOU_MEDIA_ID", user: user)

Screen tracking

Manual

To manually measure the screen view, use the method trackScreen().

class ViewController: UIViewController {
    override open func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        // Tracking screen view
        UserReport.shared?.trackScreen()
    }
}

Automatic

If you want to automatically measure views as screens using the UserReportViewController class.

class ViewController: UserReportViewController {
    ...
}

Display mode

The survey can be appear in two ways:

  • .alert – show survey like an alert view (Default)
  • .fullScreen – show survey in full screen mode, like the modal view controller

To change the display mode, please specify following:

UserReport.shared?.displayMode = .fullscreen

Change settings

To update the default rules for appear the survey use follow:

let settings = Settings()
settings.sessionScreensView = 5
settings.inviteAfterNSecondsInApp = 20

UserReport.shared?.updateSettings(settings)

Mute

In order for the survey not to be appear on important screens, you can use a variable mute.

UserReport.shared?.mute = true

Don’t forget to return back to false.

Update user info

When changing user data, you should also send the updated data to the UserRecord iOS SDK.

let user = User()
user.email = "[email protected]"

UserReport.shared?.updateUser(user)

Session info

UserReport SDK stores the data on the count of screens viewed and the time the application is used. If necessary, you can get this data from a variable session. The session contains the following values:

  • screenView – number of screen viewed in current session
  • totalScreenView – number of screen viewed in all session
  • sessionSeconds – number of seconds spent in the application for current session
  • totalSecondsInApp – number of seconds spent in the application for all time
  • localQuarantineDays – number of days through which the survey will be appear again
  • settings – current settings for appear the survey
// Session information about the running time of the application and screen views
let session = UserReport.shared?.session

// Get current settings for appear survey
let currentSetting = session?.settings

Manually

If you decide to show the survey yourself, then you can use the following method:

UserReport.shared?.tryInvite()

License

UserReport iOS SDK is released under the Apache License 2.0. See LICENSE for details.

Latest podspec

{
    "name": "UserReport",
    "version": "0.0.2",
    "summary": "UserReport SDK for iOS.",
    "description": "UserReport is a set of flexible tools, that tell you who your users are, and what they want to achieve.",
    "homepage": "https://github.com/audienceproject/userreport-ios-sdk",
    "screenshots": "https://www.userreport.com/wp-content/uploads/illustration_survey.png",
    "license": {
        "type": "Apache License, Version 2.0",
        "file": "LICENSE"
    },
    "authors": "AudienceProject",
    "social_media_url": "https://twitter.com/Audience_P",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/audienceproject/userreport-ios-sdk.git",
        "tag": "0.0.2"
    },
    "source_files": "UserReport/UserReport/**/*.{swift}",
    "frameworks": [
        "Foundation",
        "UIKit",
        "WebKit",
        "AdSupport"
    ],
    "requires_arc": true,
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This