Set Attribute
Set virtual attributes for a mobile view
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
The FS.setAttribute() API method is available to create virtual attributes of any kind on native views, read more here.
Call FS.setAttribute
to set a custom attribute as key-value pairs for a mobile view.
Additional Information
- Objective-C
- Swift
[FS setAttribute:(nonnull UIView *) attributeName:(nonnull NSString *) attributeValue:(nonnull NSString *)]
[view fsSetAttributeValue:(nonnull NSString *) forAttribute:(nonnull NSString *)]
Example Invocation
// .h file
@property (nonatomic, retain) IBOutlet UIButton *cartButton;
// .m file
- (void)viewDidLoad {
[super viewDidLoad];
[FS setAttribute:self.cartButton attributeName:@"theme-color" attributeValue:@"dark"];
}
FS.setAttribute(view: UIView, attributeName: String, attributeValue: String)
view.fsSetAttribute(name: String, value: String)
Example Invocation
@IBOutlet weak var cartButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
FS.setAttribute(checkoutButton, attributeName: "theme-color", attributeValue:"dark")
}
SwiftUI:
Button("Checkout") {
// ...
}
.fsSetAttribute(name: "theme-color", value: "dark")