Website lead capture form
If you already have a form on your own website, you can have it send each enquiry straight into GymOS as a new lead. Your form keeps its own look, and GymOS takes care of the rest: the lead appears in your leads list, gets your welcome email, and starts any follow-up you have set up.
This article explains what your form needs so that GymOS can read it. Some of it is technical, so you may want to share it with whoever looks after your website.
Your form’s address
Every form sends its answers to an address, often called the form’s action. Yours is your GymOS members’ website address with /leadform on the end, for example:
https://yourgym.fitnesshub.net/leadform
The easiest way to find it:
- Open any of your campaigns in GymOS and go to its Landing pages tab.
- Click Sign-up form URL. This copies the link to your clipboard.
- Paste it somewhere you can edit it. It will look like
https://yourgym.fitnesshub.net/c/r/AbC12/XyZ123/, or start with your own member portal vanity website domain if you have one. - Keep everything up to the end of the domain, and replace the rest with /leadform.
Two details matter: the form must send its answers (the POST method), and the address must end exactly /leadform, with no slash after it.
The fields
Each box on a form has a name as well as the label your visitor reads. GymOS goes by the name. A form builder may call it the field’s name, its ID or its key.
Who the person is
| Name | Needed? | What goes in it |
|---|---|---|
firstname | Yes | Their first name. |
lastname | No | Their last name. If there isn’t one, you can add it to the lead later. |
email | Yes | Their email address. |
mobile | Yes | Their mobile number. It must be a mobile number for your country – a landline won’t do. They don’t need to add the country code. |
If your form has a single box for the whole name, call it name instead and GymOS will split it.
GymOS also recognises the names most form builders use, whatever their capital letters, spaces, hyphens or underscores. So first_name, First Name and first-name all work. The full list is:
- First name: firstname, forename, givenname, fname, yourfirstname
- Last name: lastname, surname, familyname, lname, yourlastname
- Whole name: name, fullname, yourname
- Email: email, emailaddress, youremail
- Mobile: mobile, mobilenumber, mobilephone, phone, phonenumber, tel, telephone, cell, cellphone, contactnumber, yourmobile, yourphone, yourtel
Everything else
You can ask anything else you like – their goals, the best time to call, how they heard about you. GymOS saves every other answer as a note on the lead, one line per question, so your team sees it all in one place. The line is labelled from the field’s name, so training_goals appears as Training goals.
If your page address carries UTM tags (for example ?utm_source=facebook) and your form passes them on, they are noted too, so you can see where the enquiry came from.
Hidden fields
These three are optional. They are hidden fields: part of the form, but not shown to your visitor.
| Name | What goes in it | What it does |
|---|---|---|
gymoscompletionurl | The full address of your thank-you page, starting https:// | Where your visitor goes once their details are saved. GymOS adds ?success=true to it. |
gymoscampaign | A campaign’s Sign-up form URL or Landing page URL, copied from GymOS (or a hook’s, from the Hooks tab) | Signs the lead up to that campaign, so its nurture program and follow-up start, and the lead is credited to the campaign (or hook). A lead capture campaign is usually the right kind. |
gymoswebsite | Nothing – leave it empty | A spam trap. See Keeping out spam below. |
Without gymoscampaign, the lead is still created, with its source recorded as Our own website.
What happens when someone sends the form
When the details are complete:
- A new lead is created – or, if they are already one of your leads, their details are brought up to date.
- Their other answers are saved as a note on the lead.
- A new lead gets your welcome email, and you get your usual new lead alerts.
- Your triggers for a new lead run, as they do for any other.
- If the form named a campaign, the lead is signed up to it, and its nurture program begins.
If GymOS can’t make a lead from what was sent, the enquiry isn’t lost. It arrives in your inbox as a message titled Website form, with every answer and the reason it couldn’t be added. That happens when:
- the first name, email address or mobile number is missing, or the number isn’t a mobile;
- the email address or mobile number belongs to one of your members;
- the email address or mobile number belongs to a lead whose other details are different.
Your visitor sees the same thing whichever of these happens: your thank-you page if you gave one; otherwise the campaign’s own thank-you page; otherwise, where their browser allows it, the page your form was on; otherwise a simple GymOS page thanking them. Giving a thank-you page in gymoscompletionurl is the surest way to decide it yourself.
Using a form builder
Most website form builders can send their answers on in one of two ways. Look in your form’s settings, or your builder’s help pages, for either of these.
1. Send the form to another address
Look for a setting called something like form action, action URL, submit to URL or custom action. This is the best choice, because your visitor is taken to your thank-you page afterwards.
| Setting | Set it to |
|---|---|
| Action, or URL | Your form’s address, e.g. https://yourgym.fitnesshub.net/leadform |
| Method | POST |
| Field names | firstname, lastname, email and mobile (or any of the names listed above) |
| Hidden fields (if your builder has them) | gymoscompletionurl, and gymoscampaign if you want one |
2. Send a copy to another address (a webhook)
Look for an action called something like webhook, send data to a URL or post to URL. Your builder handles the form as normal, then sends a copy of the answers to GymOS behind the scenes.
- Set the webhook’s address to your form’s address.
- If you are asked for a format, choose form data (sometimes called form-encoded). GymOS can’t read JSON, so a builder that only sends JSON won’t work this way.
- Use the field names above where your builder lets you. Some builders send each field’s label instead, and labels such as First Name, Email Address and Phone Number work too.
- Your visitor sees your builder’s own thank-you message, so
gymoscompletionurlisn’t needed. You can still addgymoscampaignas a hidden field if your builder sends hidden fields on.
If your builder can only email you the answers, it can’t send them to GymOS. Embed a GymOS campaign form instead (see embedding a campaign form), or ask your web developer about the approach below.
Building your own form
This section is for whoever builds your website. Here is a complete form, written in plain HTML with a little jQuery to check the answers before they are sent. Copy it, then change the parts in the list underneath.
The form
<form id="gymos-lead-form" action="https://yourgym.fitnesshub.net/leadform" method="post" novalidate>
<p>
<label for="lf-firstname">First name</label>
<input type="text" id="lf-firstname" name="firstname" autocomplete="given-name">
</p>
<p>
<label for="lf-lastname">Last name</label>
<input type="text" id="lf-lastname" name="lastname" autocomplete="family-name">
</p>
<p>
<label for="lf-email">Email address</label>
<input type="email" id="lf-email" name="email" autocomplete="email">
</p>
<p>
<label for="lf-mobile">Mobile number</label>
<input type="tel" id="lf-mobile" name="mobile" autocomplete="tel">
</p>
<p>
<label for="lf-goals">What would you like to achieve?</label>
<textarea id="lf-goals" name="goals" rows="3"></textarea>
</p>
<p>
<label>
<input type="checkbox" id="lf-consent" name="consent" value="Yes">
I agree to Your Gym contacting me about my enquiry, as set out in the
<a href="https://www.yourgym.co.uk/privacy/">privacy policy</a>.
</label>
</p>
<!-- Where to send the visitor once their details are saved -->
<input type="hidden" name="gymoscompletionurl" value="https://www.yourgym.co.uk/thank-you/">
<!-- Optional: your campaign's Sign-up form URL, copied from GymOS -->
<input type="hidden" name="gymoscampaign" value="https://yourgym.fitnesshub.net/c/r/AbC12/XyZ123/">
<!-- Spam trap: people never see this box, so it stays empty -->
<div class="lf-trap" aria-hidden="true">
<label for="lf-website">Leave this empty</label>
<input type="text" id="lf-website" name="gymoswebsite" tabindex="-1" autocomplete="off">
</div>
<p class="lf-error" role="alert"></p>
<button type="submit">Send</button>
</form>
The styling
This hides the spam trap and shows any problems in red. Put it in your page’s styles.
<style>
/* Moves the spam trap off the screen, so people never see it */
.lf-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* How a problem is shown */
.lf-error { color: #b00020; }
.lf-invalid { border-color: #b00020; }
</style>
The checks
Put this just before the end of the page. It checks the visitor’s answers before the form is sent, and points out anything missing, so they can put it right there and then. It also passes on any UTM tags in the page’s address, and stops the form being sent twice by a double click. If your site already loads jQuery, leave out the first line.
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script>
jQuery(function ($) {
var $form = $('#gymos-lead-form');
// Copy any UTM tags in this page's address into the form,
// so GymOS can note where the enquiry came from
var params = new URLSearchParams(window.location.search);
params.forEach(function (value, key) {
if (/^utm_/i.test(key)) {
$('<input type="hidden">').attr('name', key.toLowerCase()).val(value).appendTo($form);
}
});
$form.on('submit', function (e) {
var problems = [];
$form.find('.lf-invalid').removeClass('lf-invalid');
function check(selector, ok, message) {
if (!ok) {
$(selector).addClass('lf-invalid');
problems.push(message);
}
}
var firstName = ($('#lf-firstname').val() || '').trim();
var email = ($('#lf-email').val() || '').trim();
var mobile = ($('#lf-mobile').val() || '').replace(/[\s().-]/g, '');
check('#lf-firstname', firstName.length > 0, 'Please enter your first name.');
check('#lf-email', /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email), 'Please enter a valid email address.');
check('#lf-mobile', /^\+?\d{10,15}$/.test(mobile), 'Please enter your mobile number.');
check('#lf-consent', $('#lf-consent').is(':checked'), 'Please tick the box so we can contact you.');
if (problems.length) {
e.preventDefault(); // keep the visitor on the page to put it right
$form.find('.lf-error').html(problems.join('<br>'));
return;
}
// Stop a second click sending the form twice
$form.find('button[type="submit"]').prop('disabled', true).text('Sending...');
});
});
</script>
What to change
- The form’s
action: your form’s address. - The value of
gymoscompletionurl: your own thank-you page. - The value of
gymoscampaign: your campaign’s link – or remove that line if you don’t want one. - The consent wording, and the link to your privacy policy.
- Any questions of your own. Add them like the “What would you like to achieve?” box, each with its own
name, and they will appear in the note on the lead.
These checks are there to help your visitor. GymOS checks every answer again when it arrives, so nothing incomplete becomes a lead even if a browser skips them.
Keeping out spam
Forms on websites attract automated spam. GymOS has a simple trap built in: the gymoswebsite box. People never see it, but spam robots tend to fill in every box they find. Anything that arrives with it filled in is quietly thrown away. The robot is shown the normal thank-you, so it learns nothing.
We also recommend adding a “not a robot” check to your form, such as Google reCAPTCHA. Most form builders offer one in their settings. For the form above, sign up for a reCAPTCHA v2 (“I’m not a robot” tick box) site key with Google, then add:
<!-- In the form, where the tick box should appear -->
<div class="g-recaptcha" data-sitekey="YOUR-SITE-KEY"></div>
<!-- Once, anywhere on the page -->
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
// In the submit check above, beside the others
check('.g-recaptcha', typeof grecaptcha !== 'undefined' && grecaptcha.getResponse().length > 0,
'Please tick the box to show you are not a robot.');
GymOS doesn’t need anything from reCAPTCHA itself, and leaves its answer out of the lead’s note.
Privacy
GymOS records that the person accepted your privacy terms when their details first arrive. Make sure your form says what you will do with their details and links to your privacy policy – and if you add a consent tick box, give it a name, as in the example, so their answer is kept in the note on the lead.
Testing your form
- Send your form with your own first name, an email address of yours that isn’t already on GymOS, and your own mobile number.
- Check you land where you expected.
- In GymOS, find the new lead, and check its details and the note with your other answers. If you gave a campaign, check the lead is signed up to it.
- Delete the test lead when you are done.
Use details that aren’t already a member’s. If they are, GymOS won’t make a lead, and you’ll get a Website form message instead – which is what is meant to happen.
If something isn’t right
| What you see | What to check |
|---|---|
| Your visitor gets a “page not found” or error page. | The form’s address ends exactly /leadform, with no slash after it, and the form uses the POST method. |
| A Website form message arrives instead of a lead. | The message says why. Usually a missing first name, an email address that isn’t valid, or a landline in place of a mobile number – or the person is already a member. |
| Nothing arrives at all. | Your form really is sending to GymOS (check the action or webhook address). Check the spam trap is empty: if a browser’s autofill is filling it in, make sure it has autocomplete="off" and is hidden as in the example. |
| The lead arrives, but isn’t on the campaign. | The gymoscampaign link is one of your own campaign links, and the campaign is active and within its start and end dates. |
| A first and last name arrive as one name, or not at all. | The field names are on the list above. A label your visitor sees doesn’t count – it’s the field’s name that GymOS reads. |
Notes
- Someone who is already one of your leads isn’t duplicated. Their details are updated, a new note is added, and they don’t get the welcome email again.
- A campaign can be set not to send the welcome email. If yours is, a lead signed up to it through your form won’t get it either.
- Files can’t be sent through this form. Anything uploaded is ignored.
- Up to 50 extra answers are kept in the note, and a very long answer is shortened.
