Skip to content

Commit 195b051

Browse files
committed
sdk changes:
- send identifier for vendor via trackScreenView request - set idfa = random uuid for simulators with iOS > 13 - update readme
1 parent 5c35fc5 commit 195b051

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ UserReport.configure(sakId: "YOUR_SAK_ID", mediaId: "YOU_MEDIA_ID", user: user,
7171
```
7272
### Screen tracking
7373
#### Manual
74-
To manually measure the screen view, use the method `trackScreen()`.
74+
To manually measure the screen view, use the method `UserReport.shared?.trackScreenView()`.
75+
Or `UserReport.shared?.trackSectionScreenView(sectionId)` for measuring section screen view.
7576

7677
```swift
7778
class ViewController: UIViewController {

UserReport/UserReport/Models/User.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public class User: NSObject {
2323
/// https://forums.developer.apple.com/thread/124604
2424
public override init() {
2525
#if targetEnvironment(simulator)
26-
self.idfa = UUID().uuidString
26+
if #available(iOS 13.0, *) {
27+
self.idfa = UUID().uuidString
28+
} else {
29+
self.idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
30+
}
2731
#else
2832
self.idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
2933
#endif

UserReport/UserReport/Network/Network.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ internal class Network {
8080
}
8181

8282
func trackScreenView(info: Info, tCode: String, completion: @escaping ((Result<Empty>) -> Void)) {
83-
//https://visitanalytics.userreport.com/hit.gif?t=[kitTcode]&rnd=%RANDOM%&d=IDFA&med=app_name
83+
//https://visitanalytics.userreport.com/hit.gif?t=[kitTcode]&rnd=%RANDOM%&d=IDFA&med=app_name&idfv=identifierForVendor
8484
let appName = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String
8585

8686
let tCode = "t=\(tCode)&"
8787
let random = arc4random_uniform(UInt32.max)
8888
let idfa = info.user?.idfa ?? ""
89-
let url = URL(string: "\(self.server.audiences)/hit.gif?\(tCode)rnd=\(random)&d=\(idfa)&med=\(appName)")
89+
let idForVendor = UIDevice.current.identifierForVendor!.uuidString
90+
let url = URL(string: "\(self.server.audiences)/hit.gif?\(tCode)rnd=\(random)&d=\(idfa)&med=\(appName)&idfv=\(idForVendor)")
9091
self.userAgent { (userAgent) in
9192
let headers = ["User-Agent": userAgent]
9293
self.sendRequest(httpMethod: HTTPMethod.GET, url: url, headers: headers, body: nil, emptyReponse: true, completion: completion)

0 commit comments

Comments
 (0)