Skip to main content

Since: 1.38.0

Create Pages

Call +[FS pageWithName:] 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 for a given UIViewController or View instance, before the first time the view appears. However, if you have no need to call these methods, you may simply call [[FS pageWithName:@"<name>" properties:<properties>] start] when the view appears (see Start Page for more information).

Parameters
    pageName NSString * required

    The name of the page.

    properties NSDictionary<NSString *, id> * optional

    A Dictionary 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 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

(id<FSPage>)pageWithName:(NSString *)pageName;
(id<FSPage>)pageWithName:(NSString *)pageName properties:(NSDictionary<NSString *, id> * _Nullable)properties;

@protocol FSPage <NSObject>

@end

Example Invocations

Create an FSPage for a homepage without properties

id<FSPage> _page;

- (void)viewDidLoad {
[super viewDidLoad];
_page = [FS pageWithName:@"Home"];
}

Create an FSPage for an ecommerce product page with properties

id<FSPage> _page;

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// Using viewDidAppear here in this example instead of viewDidLoad.
// Check if page is set yet so it's only created once.
if (_page == nil) {
_page = [FS pageWithName:@"Product" properties:@{
@"productId": @"798ith22928347",
@"category": @"Clothing",
@"name": @"Button Front Cardigan",
@"brand": @"Bright & Bold",
@"variants": @[ @"Blue", @"Red", @"White" ],
@"url": @"https://www.example.com/product/path"
}];
}
}