Simple Form

Forms must have a unique HTML id attribute set for tracking to work.

In the example code snippet below you can see that the form’s unique ID is set to “cme-custom-form-1” on line number 1.

<form action="/simple-form/" id="cme-custom-form-1" method="post">
  <fieldset>
    <h3>cme Custom Form 1</h3>
    <p>
      <label for="cme-custom-form-1-name">Name <abbr title="required">*</abbr></label>
      <input name="cme-custom-form-1-name" type="text" id="cme-custom-form-1-name" value="" required="required">
    </p>
    <p>
      <label for="cme-custom-form-1-message">Message <abbr title="required">*</abbr></label>
      <textarea name="cme-custom-form-1-message" cols="40" rows="7" id="cme-custom-form-1-message" required="required"></textarea>
    </p>
    <p>
      <input id="cme-custom-form-1-submit" type="submit" value="Go!" class="button" data-sending-label="Sending">
    </p>
  </fieldset>
</form>

Simple custom HTML form using custom JavaScript to send a conversion hit

This form will be tracked with special attributes added by JavaScript.

It also will send an exit-intent event to GA if there’s anything in the name field when a visitor tries to leave the page. Give it a try with your Omnibug debugger visible at the same time.

Contact Us About LED Driver Technology:

Simple custom HTML form with default tracking (no custom code) and hidden field for document.referrer

This form is tracked using default tracking attributes.

See the code block below for the custom JavaScript that sets the hidden field.

cme Custom Form 1

(function(){
   if (!document.URL.includes("simple-form")) return;
   try {
       document.querySelector("#referrer").setAttribute("value", document.referrer);
   } catch (error) {
     console.error(There was an error setting the hidden field. Check the ID attribute in the hidden field. ${error});
   }
 })()

Simple custom HTML form with no custom code for tracking and no form ID

This form is not tracked because there’s no unique ID set.

cme Custom Form 2 (no form ID)