Skip to main content

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

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");