Add Class
Add a class or classes 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
Call FS.addClass
to add a class name, and FS.addClasses
to add multiple class names for a mobile view. Call FS.addPopupMenuClass
to add a class name to a shown
PopupMenu. Read more about Fullstory for Mobile Apps Privacy Rules.
Pre-Configured Privacy Classes
Several pre-configured privacy classes are provided to manage privacy programmatically.
FS.MASK_CLASS
FS.MASK_WITHOUT_CONSENT_CLASS
FS.UNMASK_CLASS
FS.UNMASK_WITH_CONSENT_CLASS
FS.EXCLUDE_CLASS
FS.EXCLUDE_WITHOUT_CONSENT_CLASS
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.
addClass
convenience methods are available in Fullstory for Mobile Apps version 1.22 and newer.
addClass invocation | Equivalent convenience method |
---|---|
FS.addClass(view, FS.MASK_CLASS) | FS.mask(view) |
FS.addClass(view, FS.MASK_WITHOUT_CONSENT_CLASS) | FS.maskWithoutConsent(view) |
FS.addClass(view, FS.UNMASK_CLASS) | FS.unmask(view) |
FS.addClass(view, FS.UNMASK_WITH_CONSENT_CLASS) | FS.unmaskWithConsent(view) |
FS.addClass(view, FS.EXCLUDE_CLASS) | FS.exclude(view) |
FS.addClass(view, FS.EXCLUDE_WITHOUT_CONSENT_CLASS) | FS.excludeWithoutConsent(view) |
addPopupMenuClass
and its convenience methods are available in Fullstory for Mobile Apps version 1.30 and newer.
addPopupMenuClass invocation | Equivalent convenience method |
---|---|
FS.addPopupMenuClass(popupMenu, FS.MASK_CLASS) | FS.maskPopupMenu(popupMenu) |
FS.addPopupMenuClass(popupMenu, FS.MASK_WITHOUT_CONSENT_CLASS) | FS.maskPopupMenuWithoutConsent(popupMenu) |
FS.addPopupMenuClass(popupMenu, FS.UNMASK_CLASS) | FS.unmaskPopupMenu(popupMenu) |
FS.addPopupMenuClass(popupMenu, FS.UNMASK_WITH_CONSENT_CLASS) | FS.unmaskPopupMenuWithConsent(popupMenu) |
FS.addPopupMenuClass(popupMenu, FS.EXCLUDE_CLASS) | FS.excludePopupMenu(popupMenu) |
FS.addPopupMenuClass(popupMenu, FS.EXCLUDE_WITHOUT_CONSENT_CLASS) | FS.excludePopupMenuWithoutConsent(popupMenu) |
Additional Information
- Java
- Kotlin
public static void FS.addClass(View view, String className);
// add multiple classes
public static void FS.addClasses(View view, Collection<String> classNames);
// add class to a shown PopupMenu (added in version 1.30)
public static void FS.addPopupMenuClass(Object popupMenu, String className);
Example Invocation
// add class to view
View view = findViewById(R.id.btn_add_to_cart);
FS.addClass(view, "fs-unmask");
// or add multiple classes
List<String> cls = Arrays.asList("fs-unmask", "my-other-class");
FS.addClasses(view, cls);
// add class to shown PopupMenu
PopupMenu popupMenu = new PopupMenu(context, anchorView);
MenuInflater inflater = popupMenu.getMenuInflater();
inflater.inflate(R.menu.menu_example, popupMenu.getMenu());
popupMenu.show();
FS.addPopupMenuClass(popupMenu, "fs-unmask");
fun FS.addClass(view: View, className: String): Unit
// add multiple classes
fun FS.addClasses(view: View, classNames: Collection<String>): Unit
// add class to a shown PopupMenu (added in version 1.30)
fun FS.addPopupMenuClass(popupMenu: Any, className: String)
Example Invocation
// add class to view
val view = findViewById<View>(R.id.btn_add_to_cart)
FS.addClass(view, "fs-unmask")
// or add multiple classes
val cls = listOf("fs-unmask", "my-other-class")
FS.addClasses(view, cls)
// add class to shown PopupMenu
val popupMenu = PopupMenu(context, anchorView)
popupMenu.menuInflater.inflate(R.menu.menu_example, popupMenu.menu)
popupMenu.show()
FS.addPopupMenuClass(popupMenu, "fs-unmask")