This article will cover the steps needed to set up your event to limit the number of registrations.
Pro Feature: This feature requires a Pro or higher account. Upgrade today.
Create your event in SimpleEvents
- Open up SimpleEvents.io and create your new event.
- Check the box to limit registration.
- Change your max registration message as needed.
- Then, create your event.
Recommendation: Use the HubSpot Landing Page for your event!
Add the Custom script
You need to install this script once when you use the HubSpot forms.
- If you use HubSpot landing pages (or website), follow the steps within Option 1.
- If you use another platform (like WordPress) and use Google Tag Manager (GTM) follow Option 2.
<script>
//SimpleEvents Max Registration Helper
window.addEventListener('message', function (event) {
if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
// Select all forms on the page
const forms = document.querySelectorAll('form');
// Iterate over each form
forms.forEach(form => {
// Check if the form contains an element with the .maxRegistration class
if (form.querySelector('.maxRegistration')) {
// Find the .actions div within this form
const actionsDiv = form.querySelector('.actions');
// If the .actions div is found, remove it
if (actionsDiv) {
actionsDiv.remove();
}
}
});
}
});
</script>
Option 1: Add the Custom code block to your Pages Footer
You only have to do this one time for your entire account.
- Open up your Pages settings.
- Insert the following code within your Site footer HTML block.
Example of the script installed in the Site footer HTML section.
This code will remove the submit button when your event reaches maximum registration.
Option 2: Add the Custom code block to Google Tag Manager (GTM) or to your site footer.
- Create a new Tag
- Tag Configuration: Custom HTML
- HTML is the code above.
- Triggering: All Pages
Example of GTM setup:
Launch your event
Your setup is complete! Run your event!