BenchmarkONE has an API, which can be used for more advanced integrations, like AJAX posts or retrieving information about a contact before updating it. The main problem with this is the cookie required for webpage tracking is not generated since the contact is never directed to our application.
Luckily, there is a solution that can meet you halfway. By using a script to perform an HTTP POST to our form submission script, you will lose the flexibility to retrieve information about a contact and act accordingly since it's a unidirectional communication, but you will still be able to send the captured data to another application, store it in an internal database, and the tracking cookie will be generated as with a normal form submission.
This example uses PHP/cURL, but the logic is similar for other languages and frameworks.
1) Create a form within BenchmarkONE.
You will also want to make any configuration changes you desire, like setting a thank you page, adding actions, and handling duplicate submissions.
2) Put the form on your page.
Make sure if you code the form yourself from scratch, you include the hidden fields (like simple_spc, enable303Redirect, formID, etc.) and the pre-filled values**. Also take note of the original input names, as these will be required when you perform the POST to BenchmarkONE.
** With one exception: set "enable303Redirect" to a value of 0. See below.
3) Write your script.
This is the part you have to handle on your own. The first thing you need to do is capture the POSTed data in variables, then push that data into another application, insert it into a local database, or manipulate it in whatever way you'd like.
4) Push the data to BenchmarkONE with cURL.
You want to make sure you push the data into BenchmarkONE last. This is because you're giving up control of the browser at this point. This will redirect the browser to app.hatchbuck.com, and the contact will eventually end up on the thank you page as specified in BenchmarkONE. Be sure to set the hash keys as the input names you saw on the original BenchmarkONE form, as well as including those hidden fields. If you do not include some of the hidden field values, your POST may be rejected.
At this point, the script is simply pushing the same values from the original form submission to BenchmarkONE exactly like a "regular" form submission. Anything after this point in the code will not work, so make sure you put this section at the bottom of your script.
So here is a complete working example that will accept a form submission, push the data into a local database, and then send the POST to BenchmarkONE.
INDEX.HTML
First Name
Last Name
E-mail*
Submit
SUBMIT.PHP
prepare($insert_contacts_sql);
# EXECUTING QUERY
$insert_contacts->execute(array(':firstname' => $firstname, ':lastname' => $lastname, ':email' => $email)) or die(print_r($db->errorInfo(), true));
# NOW POSTING FIELDS TO HATCHBUCK
$hb_submit_url = "https://app.hatchbuck.com/onlineForm/submit.php";
$fields = array(
"formID" => urlencode($formid),
"enableServerValidation" => urlencode($server_validation),
"enable303Redirect" => urlencode($enable_303),
"q1_firstName1" => urlencode($firstname),
"q3_lastName3" => urlencode($lastname),
"q4_email" => urlencode($email),
"website" => urlencode($antispam),
"simple_spc" => urlencode($simple_spc)
);
# FORMATTING QUERY STRINGS IN URL FOR POST
foreach ($fields as $key=>$value) {
$fields_string .= $key.'='.$value.'&';
}
rtrim($fields_string, '&');
# INITIALIZE CONNECTION
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $hb_submit_url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
# CAPTURING ERRORS AND DROPPING CONNECTION
$result = curl_exec($ch);
curl_close($ch);
?>
Note: Support cannot assist with implementing or troubleshooting this. All code examples may need to be modified to work within an individual website, and they are intended for advanced users only.