How can I identify companies without having to add a company field to the form?

Hi.

Let’s say I have a form (just a name and email address). I place this form on two websites, website A and website B.

Anyone who submits the form on website A will be identified as being from Company A,

and anyone who submits the form on website B will be identified as being from Company B.

How can I identify companies without having to add a company field to the form?

Your software
My Mautic version is: 6.0.5
My PHP version is: 8.1
My Database type and version is:

You potentially could save the referrer - or a static value - into a hidden form field. You add this via javascript on each site individually.

1 Like

Hi

Thank @dirk_s

Thanks for your reply, I’m curious to know the script via Gemini AI

And AI gives me complex javascript. :rofl:

Then I came up with the idea of ​​adding a hidden text field on the form, and mark that field as Company name, in HTML I entered the value:“my_company_name”

and it worked

Thank you for your reply, which then gave me this idea.

1 Like

Hi,

how could that be complex? - It could be as simple as that:

<script>
if (typeof MauticFormCallback === 'undefined') {
  var MauticFormCallback = {};
}

MauticFormCallback['myformname'] = {
  onValidate: function () {
    var field = document.getElementById('mauticform_input_myformname_hiddenfield');
    if (field) {
      field.value = 'myValue';
    }
  }
};
</script>

The scripts waits until form is loaded and then sets the field with the individual value.