Since: 1.38.0
Start Page
Call -[FSPage start] to signal the start of a view for the page (see
Create Pages). Nested page views are not supported. That will
be considered the current page until -[FSPage end] or another -[FSPage start] is
called.
This is analogous to viewDidAppear in UIKit and onAppear in SwiftUI and should
typically be called there, but this may be called at any time when your page
boundary is not tied to a UIViewController or View transition (e.g., a single
authentication View toggles between login and sign up).
Subsequent calls to start will be considered distinct views of the page.
When calling the variant that accepts page property updates as a parameter, the page properties will be updated before the view of the page starts. This will merge the properties similar to calling updateProperties, not replace all current properties, but the update and start will occur as a single event.
Parameters
A Dictionary containing properties of the page that will be indexed by Fullstory. These properties will be merged with any current properties before the page is started.
Caveats
If the user changes (i.e., by calling +[FS anonymize] when a user is
set or by calling +[FS identify:] when a different non-anonymous user
is set), a new session will start, and the current page will not be defined.
You must call -[FSPage start] again if you would like the previous page view data to be set in the new
user's session.
-[FSPage start] and other page-related methods may be called while Fullstory capture is
shut down.
However, only the current page data at the time restart
is called will be captured. For example, consider the case in which events happen in the following order:
id<FSPage> pageA = [FS pageWithName:@"PageA" properties:@{ @"var1": @1 }];[pageA start];[FS shutdown];[pageA updateProperties:@{ @"var1": @2 }];[[FS pageWithName:@"PageB"] start];id<FSPage> pageC = [FS pageWithName:@"PageC" properties:@{ @"var1": @1 }];[pageC start];[pageC updateProperties:@{ @"var2": @"C" }];[FS restart];
In playback you would see: PageA has a property var1 with a value of 1; capture stops; and then capture resumes
with PageC which has a property var1 with a value of 1 and var2 with a value of "C". The update of var1 to 2
on PageA and the page view for PageB are lost, because these were never properties of the current page while
capture was enabled.
Limits
Additional Information
- Objective-C
- Swift
(void)start;
(void)startWithPropertyUpdates:(NSDictionary<NSString *, id> *_Nullable)propertyUpdates;
Example Invocations
Start a page view for a page in the app
id<FSPage> _page; // Initialized in viewDidLoad
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[_page start];
}
Start a page view for a Cart page updated with the current item count
id<FSPage> _page; // Initialized in viewDidLoad
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[_page startWithPropertyUpdates:@{
@"cartSize": [cart size]
}]
}
Capture a page view when property updates and manual ending are not needed
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[FS pageWithName:@"myPage"] start];
}
func start()
func start(withPropertyUpdates propertyUpdates: [String : Any]?)
Example Invocations
Start a page view for a page in the app
private var page: FSPage? // Initialized in viewDidLoad
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
page?.start()
}
Start a page view for a Cart page updated with the current item count
private var page: FSPage? // Initialized in viewDidLoad
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
page?.start(withPropertyUpdates: ["cartSize": cart.size])
}
Capture a page view when property updates and manual ending are not needed
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
FS.page("myPage").start()
}