--- title: "Subsequent initialization of dynamic elements" slug: "subsequent-initialization-of-dynamic-elements" updated: 2024-11-29T11:34:35Z published: 2024-11-29T11:34:35Z canonical: "docs.mapp.com/subsequent-initialization-of-dynamic-elements" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Subsequent initialization of dynamic elements > [!WARNING] > This article applies exclusively to Tracking Pixel versions 4 and 5 ## Event tracking To enable automatic event tracking for dynamic elements (e.g. when showing layers), they have to be marked. To do this, pass the value "linkTrackInit" to the object "wts" as soon as new content is reloaded. ```javascript wts.push(["linkTrackInit"]); // or wts.push(["linkTrackInstall"]); ``` ## Forms Forms that are dynamically reloaded (e.g. in a layer) have to be marked for form tracking. To do this, pass the value "formTrackInstall" to the object "wts" as soon as a new form is reloaded. ```javascript wts.push(["formTrackInstall"]); // or wts.push(["formTrackInit"]); ``` In this example, the first form on the page is tracked using an existing form element called "wt_form". If the reloaded form is not marked in this way, you can also pass the form object directly. ```javascript wts.push(["formTrackInstall", document.getElementById('FORMULARID')]); // or wts.push(["formTrackInit", document.getElementById('FORMULARID')]); ``` If you send your form via Ajax (which means the page is not left), you have to send the form request manually. ```javascript function myAjaxSubmit(formObject) { /* Your Code */ wts.push(["formTrackSubmit", "true"]); wts.push(["send", "form"]); /* Your Code */ } ``` ### Multiple forms If you want to track on a single page multiple forms, use the method "multipleFormTrackInstall" or "multipleFormTrackInit" and pass the form as an HTML element. ```javascript wts.push(['multipleFormTrackInstall', document.forms[0]]); wts.push(['multipleFormTrackInstall', document.forms[1]]); wts.push(['multipleFormTrackInstall', document.forms[2]]); ``` If you send your form via ajax or the user is not leaving the page after the form is sent, you have to send the form track request manually. Use "multipleForm" or "multipleFormTrackSubmit" for this and pass the form as an HTML element. ```javascript function myAjaxSubmit(formObject) { /* Your Code */ wts.push(['multipleFormTrackSubmit', formObject]); wts.push(['send', 'multipleForm', formObject]); /* Your Code */ } ``` If all forms should be tracked together, don't pass a form to "multipleForm". ```javascript function myAjaxSubmit(formObject) { /* Your Code */ wts.push(['multipleFormTrackSubmit', formObject]); wts.push(['send', 'multipleForm']); /* Your Code */ } ```