-
-
Save leadbi/dbcdceffc32b5fc9cb9c240f5677c7d6 to your computer and use it in GitHub Desktop.
LeadBI Native Form Integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
HTML Integration | |
Capture form data without javascript (html only) | |
More documentation: https://gist.github.com/leadbi/a458eb881007c800c045cabfd98ac8af | |
--> | |
<!-- the form id is used to capture data only from specific forms --> | |
<form id="optional-id"> | |
<input type="text" name="firstname"><br> | |
<input type="text" name="lastname"> | |
<input type="email" name="email"> | |
<input type="text" name="company"> | |
<input type="text" name="website"> | |
<input type="text" name="phone"> | |
<input type="text" name="role"> | |
<input type="text" name="custom1"> | |
<input type="text" name="custom2"> | |
<input type="text" name="custom3"> | |
<textarea name="question"> </textarea> | |
<button type="submit" value="Submit">Submit</button> | |
</form> | |
<!-- leadbi form tag --> | |
<script src="https://a.leadbi.com/f/477de9cd-2180-4a5c-bdb1-b123ad7b452424.js" id="477de9cd-2180-4a5c-bdb1-b123ad7b4511"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* JavaScript Integration | |
* Send forms to leadbi using the javascript form api | |
* More documentation: https://gist.github.com/leadbi/a458eb881007c800c045cabfd98ac8af | |
*/ | |
// leadbi.com | |
var native_formid = '3638a022-2823-4541-b31c-1856f6a72933'; | |
// get form instance | |
window.$leadbi_forms.getForm(native_formid, function (err, form) { | |
// form data | |
var data = { | |
first_name: 'test', // optional | |
last_name: 'test', // optional | |
email: 'test@test.com', // required | |
company: 'test', // optional | |
role: 'test', // optional | |
phone: '+1....', // optional | |
website: 'test.com', // optional | |
custom1: 'data', // optional | |
custom2: 'data', // optional | |
custom3: 'data', // optional | |
question: '... ?', // optional | |
privacy_consent: 1 // optional | |
}; | |
// submit form | |
return form.submit(data, function (err, result) { | |
console.log('form data sent'); | |
}); | |
}); | |
// Note: The leadbi form javascript tag needs to be embeded on the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP / Wordpress Integration | |
* Capture from on the server side | |
* More documentation: https://github.com/leadbi/leadbi-wordpress-sdk | |
*/ | |
// create new form api object | |
$formApi = new LeadBIFormAPI(); | |
$form_id= '3638a022-2823-4541-b31c-1856f1a72916'; | |
// send form data to leadbi | |
$formApi->sendForm($form_id, array( | |
'first_name' => 'John', // optional | |
'last_name' => 'Doe', // optional | |
'email' => 'jd@example.com', // requred | |
'company' => 'Example, Inc.', // optional | |
'role' => 'CMO', // optional | |
'phone' => '+1-541-754-3010', // optional | |
'website' => 'http://example.com', // optional | |
'custom1' => 'data', // optional | |
'custom2' => 'test', // optional | |
'custom3' => 'test', // optional | |
'question' => ' ... ?' // optional | |
'privacy_consent': 1 // optional | |
)); | |
// Note: the leadbi-wordpress-sdk needs to be installed in your wordpress website |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment