In general, eTrigue Standard or Progressive Forms are the preferred method by users to capture information from their visiting prospects.
However, there are cases where you might have an in-house form on your website that cannot be modified traditionally, but you still would like to send form data to eTrigue. For this, eTrigue has a solution: submitManually()
The submitManually() method is an online interface that can be used to send form data to eTrigue. For any prospect created or updated by this method, the prospect will be cookied for eTrigue known visitor tracking and have a Form entry recorded in their activity histories. Thus, these prospects will be included in searches and reporting for your campaign efforts.
NOTE: It is highly recommended that users consult their web administrators to implement the instructions below.
- Before beginning, ensure that your web page contains eTrigue Tracking code.
To obtain tracking code for your eTrigue account, click here. - Create a standard form in eTrigue.
It is good practice to have your eTrigue form contain all fields, or mirror the fields, that you plan to submit on your website's actual form. After the form has been saved, click the Export Form Code button. Please make note of the outputted code for future reference.
- Construct a data object.
eTrigue will be expecting a data object that contains all the fields you plan to submit to eTrigue. The data object should contain eTrigue field name and value pairs, separated by commas. The format is:
eTrigueFieldName: "value"
The data object should also include a valid form ID ("espFormID") as a string. You can obtain the espFormID value from the exported form code (Step 2).
For example, in the line of code below the form ID is "123":
<input type="hidden" name="espFormID" value="123" />
If your data object contains eTrigue single-select fields, their values should match the available field options as defined in DemandCenter.
If your data object contains eTrigue multi-select fields, their values should contain one or more numbers (comma separated) that match available field options as defined in DemandCenter.
Below is an example of a complete data object.
var sampledata = {
espformid: "123",
x_firstname: "Sally",
x_lastname: "Williams",
x_emailaddress: "sally.williams@etrigue.com",
x_udf_sampletext62: "hello world",
x_udf_contact47_ss: "2",
x_udf_favcolors21_ms: "10,18,29"
};
Note that "contact" is a single-select field and "favcolors" is a multi-select field. Also note that the values are ID numbers (which are outputted from Step 2), not names. - Call submitManually() to send data.
First, instantiate a new eTrigue form with your eTrigue account ID. The account ID is the same ID that is in your eTrigue Tracking Code.
var etrigueForm = new EtrigueForm(####);
...where ### is a valid account ID (integer).
Next, call submitManually() to submit data to eTrigue. The method is called like this:etrigueForm.submitManually(data, callback);
data is the data object containing all fields to be passed (from step 3).
callback can be a function that performs more actions when you get a response from submitManually().
An error response will look something like this:jsonp12345({"err":1});
A successful response will look something like this:jsonp12345({"err":0,"thankYouPage":"http:\/\/www.example.com","repost":true});
Upon receiving a successful response, you can now execute your page or form’s special processes. For example, if your form’s settings include redirection to a thank-you-page, you should redirect the visitor at this time. The redirect destination URL will be returned in a successful response from submitManually() as “thankYouPage”. - Below is an example of complete code.
This example assumes eTrigue Tracking code exists on the page, assumes “123” is a valid form ID, assumes that a form with the name “formname” exists on the page, and assumes that the formsubmit() function is called when a visitor submits the form (preferably after some data validation).
<script>
function formsubmit() {
var etgf = new EtrigueForm(####), // insert valid account ID here
data = {espformid:"123", x_firstname:"Test", x_lastname:"Tester", x_emailaddress:"testing@xx.xx"};
etgf.submitManually(data, function(r) {
// error
if (r.err) {
// handle error
return;
}
// success
if (r.thankYouPage) {
if (r.repost) {
// response contains thank you page and repost flag, set form action URL and submit form
document.formname.action = r.thankYouPage;
document.formname.submit();
} else {
// response contains only thank you page (no repost), just redirect user
window.location = r.thankYouPage;
}
}
});
}
</script
Additional Recommendations and Guidelines:
- Recommended:
Use a <button> for your form submit rather than an actual submit button to prevent accidental form submissions before the callback has a chance to return.
In other words, we do not recommend something like below:
<input type="submit"/>
- After a submit, you may receive a response code. Use the table below to determine its meaning.
Code
Description
10
General failure. (e.g. invalid syntax, missing arguments, etc.)
9
Submit call failure. (e.g. missing required arguments)
8
Data object failure. (e.g. field/value pairs incorrect or missing)
1
Post-submit error. (e.g. invalid account ID received)
0
No error.