Skip to main content

Create Pages

Call FS.page to create a new FSPage instance for a page of type pageName. This object will be used to instrument the start and end of views of the page and to update the page's properties. You MUST call FSPage#start after creating the page to signal the start of the view of the page.

Nested pages are not supported. There will only ever be one (or zero) page(s) active at a time, which will be the page that was most recently start-ed (but not end-ed).

If you want to call FSPage#updateProperties or FSPage#end on the page, you would typically call FS.page() to create the FSPage once in your widget's initState method, before the first time the view appears. However, if you have no need to call these methods, you may simply call FS.page("<name>", <properties>).start() when the view appears (see Start Page for more information).

Parameters
    pageName String required

    The name of the page.

    properties Map<String, Object?> optional

    A map containing properties of the page that will be indexed by Fullstory.

Conventions

Use constant values when choosing a pageName and put dynamic or differentiating info in the properties. For example, instead of having a "merchantX" page for each merchant in an ecommerce app, use "Merchant" as the pageName and add "merchantName": "merchantX" as a page property. Use properties for values you would want to search on. See Limits below.

Limits

  • Capture up to 50 unique properties (exclusive of pageName) on a single page.
  • Capture up to 500 unique properties across all pages.
  • The pageName field is limited to 1,000 unique values. Any new pageName values sent past this limit will be ignored.

Additional Information

FS.page(String pageName, {Map<String, Object?>? properties}) → FSPage

class FSPage {
start({Map<String, Object?>? propertyUpdates})
updateProperties(Map<String, Object?>)
end()
dispose()
}

Example Invocations

Create and start an FSPage without properties or persistence

FS.page("Home").start()

Create and start an FSPage with properties

FS.page("Home", {"theme": "dark"}).start()

Create an FSPage with updatable properties

class MyWidget extends StatefulWidget {
const MyWidget({
super.key,
});

@override
State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
late FSPage _page;

@override
void initState() {
super.initState();
_page = FS.page('My Page');
_page.start();
}

void _updatePageProperties() async {
await _page.updateProperties({
'updatedKey': 'updatedValue'
});
}

@override
void dispose() {
_page.end();
_page.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
// ...
}
}