On your website, you might have existing HTML forms that you want to keep, but still submit the data to Spectate. There are two approaches to this:
POST the data directly to Spectate from your HTML forms (client-side)
- Go to Manage > Forms.
- Click +Create Form to make a new Form.
- Recreate the existing form from your website. For example, if your existing form has the fields: First Name, Last Name, Company URL, Phone, Company, and Email then make Fields map to the Spectate-equivalents: First Name, Last Name, Website, Phone, Company, and Email.
- Expand More Options and under "Form Data Options", check the box "Allow third-party forms to submit to this form".
- Click Create to save the new Form.
- Copy the System URL for the Form (e.g.
- On your website, change the action attribute in the
<form>HTML element to the System URL you just copied. For example: Change this:
<form action="/submit.php" method="post">to this:
<form action="http://my.spectate.com/name-of-form" method="post">
- You'll also need to update the name attributes in the
<input>elements map to the Spectate equivalent. For example: Change this:
<input name="firstname" type="text" class="text-field required">to this:
<input name="first_name" type="text" class="text-field required">See the Standard Fields in Spectate Forms table below for the standard fields and their identifiers.
- Save the existing form to your site.
- You're good to go; your form data will be submitted to Spectate!
POST the data to Spectate with your own form processing code (server-side)
You may still need to capture your form submissions initially and do some processing. After which, you want to send some or all of the captured form information on to Spectate.
First, ensure that Spectate has all of the form fields you need to store your data and create any additional custom fields necessary.
Then, in your form processing code:
- Grab the fields that you want to pass to Spectate from your form submission.
- URL encode their values.
- Map the values to your Spectate form field names. Refer to the Standard Fields in Spectate Forms table below for the standard fields and their identifiers.
- Include the
_spectate_tracking_sessioncookie in your POST to allow successful conversion of visitors into leads. This requires that your site has the Spectate tracking code on it.
- Post the data to the Spectate Form's system URL (e.g.
Here is an example PHP script that accomplishes this:
* Posts data to a Spectate form
public function insertLeads($post)
$strPost = "";
//create string with form POST data
$strPost = "first_name=" . urlencode($post['first_name'])
. "&last_name=" . urlencode($post['last_name'])
. "&email=" . urlencode($post['email'])
. "&phone=" . urlencode($post['phone_number'])
. "&company=" . urlencode($post['firm_name']);
//set POST URL
$spFormUrl = "http://my.spectate.com/<your_form_url>";
//Get Spectate cookie from request
$spCookie = $_COOKIE['_spectate_tracking_session'];
//intialize cURL and send POST data
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost);
@curl_setopt($ch, CURLOPT_URL, $spFormUrl);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// set the Spectate cookie in the POST request to ensure Visitor data gets associated with new Lead
if(curl_exec($ch) === false)
$msg = curl_error($ch);
throw new Zend_Exception( $msg );
Standard Fields in Spectate Forms
Spectate form field names are converted to "snake case" meaning they are converted to lower case and the words are combined with underscores (e.g. First Name >
first_name ). Below are the fields that come with Spectate forms by default by name and their
- Address One:
- Address Two:
- Annual Revenue:
- First Name:
- Job Title:
- Last Name:
- Twitter Username:
- Years in Business:
Note regarding Email field validation
If you are using an HTML form, know that the default HTML5 email input validation is less restrictive than Spectate's Email field validation.
To avoid errors on form submission, be sure to validate your HTML form's email input. Spectate validates emails using the following regular expression: