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 initState
in an StatefulWidget and should
typically be called there, but this may be called at any time when your page
boundary is not tied to a single StatefulWidget.
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 map 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 (represented in pseudocode):
pageA = FS.page("PageA", { 'var1': 1 })
pageA.start()
FS.shutdown()
pageA.updateProperties({ 'var1': 2 })
FS.page("PageB").start()
pageC = FS.page("PageC", { '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
start()
Example Invocations
Start a page view for a page in the app
late FSPage _page;
@override
void initState() {
super.initState();
_page = FS.page('My Page');
_page.start();
}
Start a page view for a Cart page updated with the current item count
late FSPage _page;
@override
void initState() {
super.initState();
_page = FS.page('My Page');
_page.start({"cartSize": cart.size});
}
Capture a page view when property updates and manual ending are not needed
@override
void initState() {
super.initState();
FS.page("myPage").start()
}