Skip to content

Commit 917bf68

Browse files
author
Vadym Kurachevskyi
committed
Merge branch 'master' into develop
2 parents 822124d + 5245161 commit 917bf68

File tree

6 files changed

+53
-19
lines changed

6 files changed

+53
-19
lines changed

Example_Objective-C/Example_Objective-C/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1717
// Initialize UserReport SDK
1818
User *user = [[User alloc] init];
1919
[user setEmail:@"[email protected]"];
20-
[UserReport configureWithSakId:@"ios-playground" mediaId:@"df5be674-b6a8-4bb8-8f44-4c8229a01bc2" user:user userSettings:nil];
20+
[UserReport configureWithSakId:@"audienceproject" mediaId:@"3402b774-b7a8-448c-997a-ef6cd59efc41" user:user userSettings:nil];
2121
return YES;
2222
}
2323

Example_Objective-C/Example_Objective-C/Base.lproj/Main.storyboard

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="x5P-1q-8t9">
3-
<device id="retina6_1" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="x5P-1q-8t9">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
64
<dependencies>
75
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
97
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
108
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
119
</dependencies>
@@ -38,7 +36,7 @@
3836
<rect key="frame" x="20" y="64" width="374" height="788"/>
3937
<subviews>
4038
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PlF-Z5-ZUN">
41-
<rect key="frame" x="94.5" y="625.5" width="185" height="40"/>
39+
<rect key="frame" x="94.5" y="675.5" width="185" height="40"/>
4240
<constraints>
4341
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="185" id="92H-bD-0Nh"/>
4442
<constraint firstAttribute="height" constant="40" id="tjk-kO-KUn"/>
@@ -52,7 +50,7 @@
5250
</connections>
5351
</button>
5452
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="OiT-rj-l93">
55-
<rect key="frame" x="0.0" y="20" width="374" height="585.5"/>
53+
<rect key="frame" x="0.0" y="20" width="374" height="635.5"/>
5654
<subviews>
5755
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cRL-zO-4in" customClass="ShadowView">
5856
<rect key="frame" x="0.0" y="0.0" width="374" height="238"/>
@@ -143,10 +141,10 @@
143141
</userDefinedRuntimeAttributes>
144142
</view>
145143
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WDH-DF-Ws7" customClass="ShadowView">
146-
<rect key="frame" x="0.0" y="258" width="374" height="327.5"/>
144+
<rect key="frame" x="0.0" y="258" width="374" height="377.5"/>
147145
<subviews>
148146
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="LC3-dQ-XEM">
149-
<rect key="frame" x="10" y="10" width="354" height="307.5"/>
147+
<rect key="frame" x="10" y="10" width="354" height="357.5"/>
150148
<subviews>
151149
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nyp-K0-2DF">
152150
<rect key="frame" x="0.0" y="0.0" width="354" height="43.5"/>
@@ -418,20 +416,45 @@
418416
<constraint firstItem="RGl-hY-4he" firstAttribute="top" secondItem="3Ye-Je-6hZ" secondAttribute="top" id="ypI-zq-i8W"/>
419417
</constraints>
420418
</view>
421-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2dR-F2-zPd">
419+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tZO-2M-6WQ">
422420
<rect key="frame" x="0.0" y="267.5" width="354" height="40"/>
423421
<subviews>
424-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VDo-w2-rDC">
422+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="INq-Y7-V2x">
425423
<rect key="frame" x="0.0" y="0.0" width="125" height="40"/>
426424
<constraints>
427-
<constraint firstAttribute="height" constant="40" id="8Cc-Kz-U7w"/>
428-
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="125" id="BGx-Tw-mIM"/>
425+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="125" id="KPK-md-mad"/>
426+
<constraint firstAttribute="height" constant="40" id="k51-n5-RGF"/>
429427
</constraints>
430428
<state key="normal" title="trackScreen()" backgroundImage="bg_button_normal">
431429
<color key="titleColor" red="0.56470588239999997" green="0.51764705879999995" blue="1" alpha="1" colorSpace="calibratedRGB"/>
432430
</state>
433431
<connections>
434-
<action selector="trackScreen:" destination="BYZ-38-t0r" eventType="touchUpInside" id="HLa-9u-REZ"/>
432+
<action selector="trackScreen:" destination="BYZ-38-t0r" eventType="touchUpInside" id="HZX-MH-Eni"/>
433+
</connections>
434+
</button>
435+
</subviews>
436+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
437+
<constraints>
438+
<constraint firstItem="INq-Y7-V2x" firstAttribute="leading" secondItem="tZO-2M-6WQ" secondAttribute="leading" id="2Ph-fa-CvJ"/>
439+
<constraint firstItem="INq-Y7-V2x" firstAttribute="top" secondItem="tZO-2M-6WQ" secondAttribute="top" id="C2H-nx-1bG"/>
440+
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="INq-Y7-V2x" secondAttribute="trailing" id="NSY-g7-5XC"/>
441+
<constraint firstAttribute="bottom" secondItem="INq-Y7-V2x" secondAttribute="bottom" id="tvl-Av-dDa"/>
442+
</constraints>
443+
</view>
444+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2dR-F2-zPd">
445+
<rect key="frame" x="0.0" y="317.5" width="354" height="40"/>
446+
<subviews>
447+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VDo-w2-rDC">
448+
<rect key="frame" x="0.0" y="0.0" width="175" height="40"/>
449+
<constraints>
450+
<constraint firstAttribute="height" constant="40" id="8Cc-Kz-U7w"/>
451+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="175" id="BGx-Tw-mIM"/>
452+
</constraints>
453+
<state key="normal" title="trackSectionScreen()" backgroundImage="bg_button_normal">
454+
<color key="titleColor" red="0.56470588239999997" green="0.51764705879999995" blue="1" alpha="1" colorSpace="calibratedRGB"/>
455+
</state>
456+
<connections>
457+
<action selector="trackSessionScreen:" destination="BYZ-38-t0r" eventType="touchUpInside" id="iKc-5a-3wV"/>
435458
</connections>
436459
</button>
437460
</subviews>

Example_Objective-C/Example_Objective-C/ViewController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ - (IBAction)trackScreen:(id)sender {
123123
[self updateSessionInfo];
124124
}
125125

126+
- (IBAction)trackSessionScreen:(id)sender {
127+
[[UserReport shared] trackSectionScreenView:@"b556da9f-9443-44ab-aa48-63d579318b69"];
128+
[self updateSessionInfo];
129+
}
130+
126131
// MARK: Helpers
127132

128133
- (NSString *)stringFromTimeInterval:(NSTimeInterval)interval {

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)