Skip to content

Commit 71ae27b

Browse files
author
Vadym Kurachevskyi
authored
Merge pull request #9 from audienceproject/feature/readme-suggested-updates
Separate usage examples for sceen tracking and surveying.
2 parents 5d50713 + 063a4a6 commit 71ae27b

File tree

1 file changed

+53
-36
lines changed

1 file changed

+53
-36
lines changed

README.md

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- iOS 9.0+
1515

1616
## Installation
17-
UserReport iOS SDK can be installed in various ways.
17+
The UserReport iOS SDK can be installed in various ways.
1818

1919
### CocoaPods
2020
[CocoaPods](https://cocoapods.org/) is a centralized dependency manager for
@@ -42,47 +42,40 @@ In your project folder enter:
4242
$ git submodule add [email protected]:AudienceProject/userreport-ios-sdk.git
4343
```
4444

45-
## Usage
45+
## Usage for screen/section tracking
4646
### Configure
47-
Configure UserReport iOS SDK via `SAK_ID`, `MEDIA_ID` (You can find these values on media setting page) and information about user.
47+
Configure the UserReport iOS SDK using your `SAK_ID` and your `MEDIA_ID`.
4848

49-
```swift
50-
// Create user object (optional)
51-
let user = User()
52-
user.email = "[email protected]"
53-
54-
// You can also specify a email hash
55-
user.emailMd5 = "MD5_EMAIL_HASH"
56-
user.emailSha1 = "SHA1_EMAIL_HASH"
57-
user.emailSha256 = "SHA256_EMAIL_HASH"
58-
59-
// Provide additional social network information
60-
user.facebookId = "FACEBOOK_ID"
61-
62-
//It is also possible to override default rules when survey will appear;
63-
//though, userSettings parameter is optional
64-
let settings = Settings()
65-
settings.sessionScreensView = 5
66-
settings.inviteAfterNSecondsInApp = 20
49+
Your `SAK_ID` and `MEDIA_ID` can be found on the Media Setting page in UserReport.
6750

51+
```swift
6852
// Configure
69-
UserReport.configure(sakId: "YOUR_SAK_ID", mediaId: "YOU_MEDIA_ID", user: user, userSetting: setting)
53+
UserReport.configure(sakId: "YOUR_SAK_ID", mediaId: "YOUR_MEDIA_ID")
7054
7155
```
56+
7257
### Screen tracking
73-
There are two types of tracking *ScreenView* and *SectionScreenView*. One should be used in favor of another depending on the media.
58+
#### Automatic tracking
59+
If you want to automatically measure all screen views, your application's `ViewController`s should inherit from the `UserReportViewController` class.
7460
61+
Example of automatic tracking:
62+
63+
```swift
64+
class ViewController: UserReportViewController {
65+
...
66+
}
67+
```
7568
76-
#### Screen View
77-
If a media (website) has one topic it can be tracked by using `UserReport.trackScreenView`.
69+
#### Manual tracking
70+
There are two types of tracking:
71+
- Screen view tracking (`UserReport.trackScreenView()`)
72+
- Section view tracking (`UserReport.trackSectionScreenView()`)
7873
79-
#### Section Screen View
80-
If a website has different sections, for instance, media has *Health*, *World news*, *Local news* and it should be tracked differenlty `UserReport.trackSectionScreenView(sectionId)` method should be used instead.
74+
If a media (website) has one single topic, it can be tracked using `UserReport.trackScreenView()`.
8175
82-
#### Manual invocation
83-
If `UserReport.trackSectionScreenView` or `UserReport.trackScreenView()` methods invoked by your code, automatic tracking should not be used.
76+
If a website has different sections, for instance *Health*, *World news* and *Local news*, then it should be tracked using `UserReport.trackSectionScreenView(sectionId)`. The `sectionId` for a particular section can be found on the Media Setting page in UserReport.
8477
85-
#### Example
78+
Example of manual tracking:
8679
```swift
8780
class ViewController: UIViewController {
8881
override open func viewDidAppear(_ animated: Bool) {
@@ -94,13 +87,37 @@ class ViewController: UIViewController {
9487
}
9588
```
9689
97-
#### Automatic tracking
98-
If you want to automatically measure screen views. Application's ViewControllers should be inherited from the `UserReportViewController` class.
90+
#### Do not combine automatic and manual tracking
91+
If you use the `UserReport.trackSectionScreenView` and/or `UserReport.trackScreenView()` methods, then automatic tracking should be disabled. As you can see in the manual tracking example, the `ViewController` does *not* inherit from `UserReportViewController`.
92+
93+
## Usage for surveying
94+
### Configure
95+
Configure the UserReport iOS SDK using your `SAK_ID`, your `MEDIA_ID` and information about the user.
96+
97+
Your `SAK_ID` and `MEDIA_ID` can be found on the Media Setting page in UserReport.
9998
10099
```swift
101-
class ViewController: UserReportViewController {
102-
...
103-
}
100+
// Create user object (optional)
101+
let user = User()
102+
user.email = "[email protected]"
103+
104+
// You can also specify a email hash
105+
user.emailMd5 = "MD5_EMAIL_HASH"
106+
user.emailSha1 = "SHA1_EMAIL_HASH"
107+
user.emailSha256 = "SHA256_EMAIL_HASH"
108+
109+
// Provide additional social network information
110+
user.facebookId = "FACEBOOK_ID"
111+
112+
//It is possible to override the default rules for when a survey will appear.
113+
//However, the settings parameter is optional.
114+
let settings = Settings()
115+
settings.sessionScreensView = 5
116+
settings.inviteAfterNSecondsInApp = 20
117+
118+
// Configure
119+
UserReport.configure(sakId: "YOUR_SAK_ID", mediaId: "YOUR_MEDIA_ID", user: user, userSetting: settings)
120+
104121
```
105122
106123
### Display mode
@@ -172,7 +189,7 @@ UserReport.tryInvite()
172189
```
173190
174191
### IDFA
175-
SDK relies on IDFA. So make sure marking appropriate checkboxes when publishing your app.
192+
The SDK relies on IDFAs, so make sure to mark the appropriate checkboxes when publishing your app.
176193
177194
## License
178195

0 commit comments

Comments
 (0)