This guide walks you through embedding a Tripleseat lead form into your website. Please share this with your web developer if you don’t manage your site directly.
Inserting the Code
- Retrieve the Embed Code: Go to Settings > Lead Forms > Setup Codes in Tripleseat to get your embed code.
- Add to HTML: Copy the embed code and paste it into the desired location in your HTML file. Example code:
<script src="https://api.tripleseat.com/v1/leads/ts_script.js?lead_form_id=2&public_key=DoNotUseThisCodePlease12345" type="text/javascript"></script>
<a href="http://www.tripleseat.com" id="tripleseat_link">Private Event Software powered by Tripleseat</a>
- Verify the Form: Load the page to verify the form renders correctly. If issues arise, create a test page and submit a support ticket with the page link.
Styling the Form (Optional)
To match your website’s design, you can override the default CSS. For example, to add 10px padding:
body #tripleseat_embed_form table td {
padding: 10px;
}
padding: 10px;
}
Mobile-Friendly Layout
To enable a mobile-friendly layout, modify the embed script URL by adding &inline_form=true
. Example:
<script src="https://api.tripleseat.com/v1/leads/ts_script.js?lead_form_id=2&public_key=DoNotUseThisCodePlease12345&inline_form=true" type="text/javascript"></script>
Customizing Submission Behavior
Thank You Page Redirection
Use JavaScript hooks for custom actions on form submission. Example for redirecting after submission:
<script>
TS.custom_success_callback = function(success_message, lead_id) {
window.location = 'https://www.wordpresstechy.com/thank-you/';
record_new_lead(lead_id);
};
</script>
TS.custom_success_callback = function(success_message, lead_id) {
window.location = 'https://www.wordpresstechy.com/thank-you/';
record_new_lead(lead_id);
};
</script>
For improved error handling:
<script>
TS.custom_errors_callback = function(errors) {
$ts.each(errors, function(field, error) {
alert(field + ': ' + error);
});
};
</script>
TS.custom_errors_callback = function(errors) {
$ts.each(errors, function(field, error) {
alert(field + ': ' + error);
});
};
</script>
Adwords or Analytics Tracking
Track campaigns by redirecting to a thank-you page or executing custom JavaScript:
<script>
TS.custom_success_callback = function(success_message, lead_id) {
window.location = 'http://yourwebsite.com/thank-you';
};
</script>
TS.custom_success_callback = function(success_message, lead_id) {
window.location = 'http://yourwebsite.com/thank-you';
};
</script>
Tracking by Lead Source
To track custom lead sources, dynamically add a hidden field to the form:
<script>
if (lead_source_condition) {
$ts('#tripleseat_embed_form').append("<input type='hidden' id='lead_lead_source_id' name='lead[selected_lead_sources_attributes][0][lead_source_id]' value='{lead source ID}' />");
}
</script>
if (lead_source_condition) {
$ts('#tripleseat_embed_form').append("<input type='hidden' id='lead_lead_source_id' name='lead[selected_lead_sources_attributes][0][lead_source_id]' value='{lead source ID}' />");
}
</script>