Since: 1.38.0
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 this method to create the FSPage
once in your Activity's
or Fragment's onCreate
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
The name of the page.
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 e‑commerce 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.
Persistence
FSPage
implements android.os.Parcelable
, so you may persist it in
onSaveInstanceState
and restore it in onRestoreInstanceState
or
onCreate(Bundle)
to retain any properties you have set on the page
without needing to remember, recalculate, and reapply them on configuration
changes or process recreation.
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 newpageName
values sent past this limit will be ignored.
Additional Information
- Java
- Kotlin
public static void page(String pageName);
public static void page(String pageName, Map<String, ?> properties);
public final class FSPage implements Parcelable { … }
Example Invocations
Create an FSPage for a homepage without properties or persistence
private FSPage page = FS.page("Home");
Create an FSPage for an e‑commerce product page with persistence
private FSPage page;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
Map<String, Object> pageProperties = new HashMap<String, Object>() {
{
put("productId", "798ith22928347");
put("category", "Clothing");
put("name", "Button Front Cardigan");
put("brand", "Bright & Bold");
put("variants", new ArrayList<String>() {
{
add("Blue");
add("Red");
add("White");
}
});
put("url", "https://www.example.com/product/path");
}
};
this.page = FS.page("Product", pageProperties);
} else {
this.page = savedInstanceState.getParcelable("com.myapp.PAGE");
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable("com.myapp.PAGE", page);
}
fun FS.page(pageName: String)
fun FS.page(pageName: String, properties: Map<String, *>)
class FSPage : Parcelable { ... }
Example Invocations
Create an FSPage for a homepage without properties or persistence
private val page = FS.page("Home")
Create an FSPage for an e‑commerce product page with persistence
private var page: FSPage? = null;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
savedInstanceState?.let {
this.page = it.getParcelable("com.myapp.PAGE")
} ?: run {
val pageProperties = mapOf(
"productId" to "798ith22928347",
"category" to "Clothing",
"name" to "Button Front Cardigan",
"brand" to "Bright & Bold",
"variants" to listOf("Blue", "Red", "White"),
"url" to "https://www.example.com/product/path"
)
this.page = FS.page("Product", pageProperties)
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putParcelable("com.myapp.PAGE", page)
}