Skip to main content

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
    pageName String required

    The name of the page.

    properties Map<String, ?> 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.

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 20 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

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 ecommerce 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);
}