JotForm integration
A form builder that helps you create & publish online forms anywhere, anytime without writing a single line of code.
JotForm is an online service for form creation. You can setup a forms with payment buttons and this integration is exactly for those, in case you want to track orders done by any of your JotForm forms.
JotForm setup
To be able to track your form results, you have to setup two options in JotForm admin:
- set a form “thank you” page in each form (choose one where you will be able to insert PHP code)
- set preferences of the form to send POST data to thank you page (edit form > Preferences > Advanced Settings)
Save your changes.
Thank you page integration
Now you have to integrate the page you’ve chosen in preferences of your forms. This is the code, just paste it into your PHP thank you page:
<?php /********* Post Affiliate Pro integration snippet *******/
if (isset($_POST['enteryour4'])) {
// total cost
$total = 0;
if (isset($_POST['selectyour'])) {
$select = "selectyour";
}
else {
for ($i = 0; $i < 100; $i++) {
if (isset($_POST["selectyour".$i])) {
$select = "selectyour".$i;
}
}
}
foreach ($_POST[$select] as $row) {
$t = str_replace('{"',"",stripslashes($row));
$t = str_replace('"}',"",$t);
$vals = explode('","',$t);
foreach ($vals as $row) {
$pairs = explode('":"',$row);
if ($pairs[0] == 'price') {
$total = $total + $pairs[1];
}
}
}
?>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php echo $total; ?>');
sale.setOrderID('<?php echo $_POST['enteryour4']; ?>');
sale.setProductID('<?php echo $_POST['enteryour']; ?>');
PostAffTracker.register();
</script>
<?php
}
/******** Post Affiliate Pro integration snippet *******/
?>
The tracking code uses your custom variables, so you have to check in the code, if yours are the same.
In the example, we are using:
- enteryour – which stands for customer full name
- enteryour4 – which stands for email
- selectyour – which stands for the product your customer has chosen
Do not forget you have to integrate your landing pages with the click tracking code.