Connect your website forms
Send leads from Forminator, Contact Form 7, Elementor or an HTML form to CJM with the ready-made script from the dashboard.
When someone submits a form on your website, CJM can record them as a lead, link them to their visit and calculate Fit and Intent from their answers. The dashboard generates a ready-made script for your form builder: you only paste it into your site and, if needed, adjust a few field names.
Before you start
- The CJM Pixel is installed on the same pages as the form. If it isn't, the connection window shows The CJM pixel is not active on your site yet with an Install the pixel button.
- You created the form in CJM and published it. See Create a manual form.
- You can edit your website code, for example with the WPCode plugin in WordPress or Elementor Custom Code.
Connect the form
Open the Connection tab
Open Setup → Lead forms, select your form, then the Connection tab. In the From your website section, the dot next to the title shows whether the pixel is active: Pixel active on … or Pixel not active yet.
Choose your form builder
Select Forminator, Contact Form 7, Elementor, or Other website if the form is plain HTML or built with another tool.
Say which form to connect (optional)
In the first field, enter the identifier of the form on your site. The script will only react to that form. If you leave it empty, the script sends every form of that type on your pages to CJM.
Copy and paste the script
Copy the script from Paste this script into your site and add it where shown below for your builder. The script already contains the CJM form identifier and the questions you configured.
Adjust the field names
The script uses the builder's default names for name, email and phone, and the CJM identifiers for the other questions. If your form fields have different names, change them in the script: there is a full Forminator example below.
Send a test
The bottom of the window shows Waiting for the first lead…. Submit the form on your site: after a few seconds the status changes to Lead received without reloading the page. The lead also appears in the Leads received tab.
Instructions for each form builder
In these examples the CJM form is called “Demo request” and has two questions: How many employees? (answers 1-10, 11-50, More than 50) and When do you want to start? (answers Right away, Within 3 months, Just exploring). Your script will contain your own questions.
Where to find the form ID: in the shortcode, for example [forminator_form id="1234"]. Leave it empty to connect every Forminator form.
Where to paste the script: in the site footer, for example with the WPCode plugin (Footer location). The script only runs when Forminator confirms a successful submission, so it doesn't record attempts with validation errors.
Default contact field names:
| Data | Forminator field name |
|---|---|
| Full name | name-1 |
email-1 | |
| Phone | phone-1 |
<script>
jQuery(document).on('forminator:form:submit:success', function (e, formData) {
if (String(formData.get('form_id')) !== '1234') return;
var field = function (name) {
return formData.getAll(name).concat(formData.getAll(name + '[]')).join(', ').trim();
};
if (!window.CJMPixel) return;
// Change the field names below if they differ in your form
var fullName = field('name-1').split(/\s+/);
window.CJMPixel.trackLead({
contact: {
firstName: fullName.shift(),
lastName: fullName.join(' ') || undefined,
email: field('email-1').toLowerCase(),
phone: field('phone-1').replace(/[\s-]/g, '') || undefined,
},
form_responses: [
{ questionId: 'how_many_employees', questionText: 'How many employees?', answer: field('how_many_employees') },
{ questionId: 'when_do_you_want_to_start', questionText: 'When do you want to start?', answer: field('when_do_you_want_to_start') },
].filter(function (r) { return r.answer; }),
source_metadata: {
formId: 'demo-request',
form_name: 'Demo request',
},
});
});
</script>Adjust the questions. Forminator gives fields automatic names such as select-1 or radio-1, which you can't rename. So replace only the name inside field('…') and leave questionId unchanged. The field name is shown in the Forminator editor or, on the page, in the field's name attribute.
If “How many employees?” is field select-1 and “When do you want to start?” is field radio-1, the lines become:
form_responses: [
{ questionId: 'how_many_employees', questionText: 'How many employees?', answer: field('select-1') },
{ questionId: 'when_do_you_want_to_start', questionText: 'When do you want to start?', answer: field('radio-1') },
].filter(function (r) { return r.answer; }),Finally, in the options of each Forminator field, check that the value of every answer matches the answer configured in CJM, for example More than 50.
Get answers recognized
For an answer to count toward Fit or Intent, the value sent by your site must match one of the question's answers in CJM. Letter case and leading or trailing spaces don't matter.
- If you rename an answer in CJM after creating it, the value to send doesn't change: Sent as “…” appears under the answer with the value your site must keep sending.
- If an answer doesn't match, the lead is still recorded, but that answer doesn't count toward the score.
- Name, email and phone go in the contact details, not in the answers: the script already handles this.
Multiple-choice questions
With the generated script, a Multiple choice question with several selected answers arrives as a single text (for example 11-50, More than 50) and isn't recognized. For questions that should count toward the score, use Single choice.
Common issues
If the form isn't on your website but in Zapier, Make or another tool, use the form webhook instead.