Add Class
Identify views and manage privacy
To simplify management of privacy for mobile applications and to enable individuals who have worked with Fullstory for the web to have a more familiar experience, Fullstory for Mobile Apps instrumentation creates virtual HTML-like elements for native Android or iOS views for the purposes of privacy management, funnel definition, and searches. read more here
Call FS.addClass
to add a class name, and FS.addClasses
to add multiple class names for a mobile view. Read more about
Fullstory for Mobile Apps Privacy Rules.
- Objective-C
- Swift
Pre-Configured Privacy Classes
Several pre-configured privacy classes are provided to manage privacy programmatically.
FSViewClassMask
FSViewClassMaskWithoutConsent
FSViewClassUnmask
FSViewClassUnmaskWithConsent
FSViewClassExclude
FSViewClassExcludeWithoutConsent
The behavior of the *Consent
classes depends on FS.consent.
Convenience Methods
Several convenience methods are also provided to simplify adding the pre-configured classes to views. These methods are available in Fullstory for Mobile Apps version 1.22 and newer.
addClass invocation | Equivalent convenience method |
---|---|
[FS addClass:view className:FSViewClassMask] | [FS mask:view] |
[FS addClass:view className:FSViewClassMaskWithoutConsent] | [FS maskWithoutConsent:view] |
[FS addClass:view className:FSViewClassUnmask] | [FS unmask:view] |
[FS addClass:view className:FSViewClassUnmaskWithConsent] | [FS unmaskWithConsent:view] |
[FS addClass:view className:FSViewClassExclude] | [FS exclude:view] |
[FS addClass:view className:FSViewClassExcludeWithoutConsent] | [FS excludeWithoutConsent:view] |
[view fsAddClass:FSViewClassMask] | [view fsMask] |
[view fsAddClass:FSViewClassMaskWithoutConsent] | [view fsMaskWithoutConsent] |
[view fsAddClass:FSViewClassUnmask] | [view fsUnmask] |
[view fsAddClass:FSViewClassUnmaskWithConsent] | [view fsUnmaskWithConsent] |
[view fsAddClass:FSViewClassExclude] | [view fsExclude] |
[view fsAddClass:FSViewClassExcludeWithoutConsent] | [view fsExcludeWithoutConsent] |
Pre-Configured Privacy Classes
Several pre-configured privacy classes are provided to manage privacy programmatically.
FSViewClass.mask
FSViewClass.maskWithoutConsent
FSViewClass.unmask
FSViewClass.unmaskWithConsent
FSViewClass.exclude
FSViewClass.excludeWithoutConsent
The behavior of the *Consent
classes depends on FS.consent.
Convenience Methods
Several convenience methods are also provided to simplify adding the pre-configured classes to views. These methods are available in Fullstory for Mobile Apps version 1.22 and newer.
addClass invocation | Equivalent convenience method |
---|---|
FS.addClass(view, .mask) | FS.mask(view) |
FS.addClass(view, .maskWithoutConsent) | FS.maskWithoutConsent(view) |
FS.addClass(view, .unmask) | FS.unmask(view) |
FS.addClass(view, .unmaskWithConsent) | FS.unmaskWithConsent(view) |
FS.addClass(view, .exclude) | FS.exclude(view) |
FS.addClass(view, .excludeWithoutConsent) | FS.excludeWithoutConsent(view) |
view.fsAddClass(.mask) | view.fsMask() |
view.fsAddClass(.maskWithoutConsent) | view.fsMaskWithoutConsent() |
view.fsAddClass(.unmask) | view.fsUnmask() |
view.fsAddClass(.unmaskWithConsent) | view.fsUnmaskWithConsent() |
view.fsAddClass(.exclude) | view.fsExclude() |
view.fsAddClass(.excludeWithoutConsent) | view.fsExcludeWithoutConsent() |
Additional Information
- Objective-C
- Swift
[FS addClass:(nonnull UIView *) className:(nonnull NSString *)]
[view fsAddClass:(nonnull NSString *)]
// add multiple classes
[FS addClasses:(nonnull UIView *) classNames:(nonnull NSArray<NSString *> *)]
[view fsAddClasses:(nonnull NSArray<NSString *> *)]
Example Invocation
// .h file
@property (nonatomic, retain) IBOutlet UIButton *cartButton;
// .m file
- (void)viewDidLoad {
[super viewDidLoad];
[FS addClass:self.cartButton className:@"fs-unmask"];
// or add multiple classes
[FS addClasses:self.cartButton classNames:@[@"fs-unmask",@"my-other-class"]];
}
FS.addClass(view: UIView, className: String)
view.fsAddClass(String)
// add multiple classes
FS.addClasses(view: UIView, classNames: [String])
view.fsAddClasses([String])
Example Invocations
@IBOutlet weak var cartButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
FS.addClass(cartButton, className: "fs-unmask")
// or add multiple classes
FS.addClasses(cartButton, classNames: ["fs-unmask","my-other-class"])
}
SwiftUI privacy controls
Text("Unmasked text")
.fsUnmask()
Text("Masked text")
.fsMask()
Text("Excluded text")
.fsExclude()
SwiftUI view identification
Text("One class")
.fsAddClass("my-class")
Text("Multiple classes")
.fsAddClasses(["my-class", "my-other-class"])