Prevent tracking for multiple forms/selectors at once

gerard_reyes Posted by: Gerard Reyes Date Posted: April 25, 2024
Back to Case Studies

Issue

The client’s LeadManagerFX form configuration is plagued by generic forms with varying numbers, which are dynamically generated per customer. The total garbage forms generated were more than 1k+. This also makes the configuration page hard to load because sometimes the server times out. Screenshot

Examples:

  1. .form-inline.full-width.ng-tns-c249–218.ng-untouched.ng-pristine
  2. .form-inline.full-width.ng-tns-c249–83.ng-pristine.ng-valid.ng-submitted.ng-touched
  3. .form-inline.full-width.ng-tns-c256–14.ng-untouched.ng-pristine.ng-submitted

Solution

I added a prevent tracking with a selector: [class*="ng-tns-c"]

This blocks any forms that have the class ng-tns-c regardless of the dynamic numbers that may appear after it.

This trick is mostly used in Mapped Forms, but this is to share that this also works for Prevent Tracking.

Achievement

The client’s LeadManagerFX form configuration is now clean, and no garbage forms are being generated.

Snippet/Screenshot/Link

Ticket: Link