Infusionsoft is a sales and marketing software built for small business. The integration with it is based on a special code placed to a 'Thank You' page and a built-in plugin.

1.

Built-in Infusionsoft Thank You pages

Login to your Infusionsoft admin panel and open the account you want to integrate (in case you have more of them). Navigate to Ecommerce> Ecommerce setup> Checkout> Order forms and edit every form you want to track sales for. Navigate to the Thank You Page. If you use the built in Thank you page, please place the following code there:

<script type="text/javascript">
	document.write(decodeURI("<script id='pap_x2s6df8d' src='https://URL_TO_PostAffiliatePro/scripts/trackjs.js' type='text/javascript'></script>"));
</script>
<script type="text/javascript">
	var customerId = '~Contact.Id~';
	var email = '~Contact.Email~';
	var callBack = false;

	function getVisitorId() {
		return PostAffTracker._getAccountId()   PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue();
	}

	function visitorCallBack() {
		if (callBack == false) {
			if ('null' != getVisitorId()) {
				callBack = true;
				var pixel = document.createElement("img");pixel.width=1;pixel.height=1;
				var tempsource = 'https://URL_TO_PostAffiliatePro/plugins/Infusionsoft/infusionsoft.php?visitorId=' getVisitorId() '&custId=' customerId '&email=' email;
				var source = tempsource.replace(/amp;/g,'');
				pixel.src = source;
				document.body.appendChild(pixel);
			}
		}
	}
	
	PostAffTracker._cmanager.loadHttpCookies();
	
	if (getVisitorId().indexOf('null') != -1) {
		PostAffTracker._cmanager.readAllFlashCookies();
		setTimeout(function() {visitorCallBack();}, 1800);
		PostAffTracker.executeOnResponce.push(function() {visitorCallBack();});
	}
	else {
		visitorCallBack();
	}
	try {
		PostAffTracker.track();
	}
	catch(e){}
</script>

Save your work and continue to the step 3.

2.

Custom Thank You page

In case you use a custom thank you page (Web Address option in Ecommerce> Ecommerce setup> Checkout> Order forms - edit one> Thank You Page) then you should enable the option Pass contact's information to the Thank You Page.

Remember the thank you page has to be PHP based to make the tracking working.

FYI: You can use the same thank you page for all your forms.

Now, let's edit your custom Thank You page file - add the following code to the file. Remember the file has to support PHP code!

<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript">
</script>
<script type="text/javascript">
var customerId = '<?php echo $_GET['contactId']; ?>';
var orderId = '<?php echo $_GET['orderId']; ?>';
var email = '<?php echo urlencode($_GET['inf_field_Email']); ?>';
var callBack = false;

function getVisitorId() {
	return PostAffTracker._getAccountId()   PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue();
}

function visitorCallBack() {
  if (callBack == false && "null" != getVisitorId()) {
    callBack = true;
    var pixel = document.createElement("img");pixel.width=1;pixel.height=1;
    pixel.src = 'http://URL_TO_PostAffiliatePro/plugins/Infusionsoft/infusionsoft.php?visitorId='
     getVisitorId() '&custId=' customerId '&orderId=' orderId '&email=' email;
    document.body.appendChild(pixel);
  }
}

PostAffTracker._cmanager.loadHttpCookies();
if (getVisitorId().indexOf('null') != -1) {
	PostAffTracker._cmanager.readAllFlashCookies();
	setTimeout(function() {visitorCallBack();}, 1800);
	PostAffTracker.executeOnResponce.push(function() {visitorCallBack();});
}
else {
	visitorCallBack();
}

try {
  PostAffTracker.track();
}
catch(e){}
</script>

As you can see, the code starts and ends as a JavaScript, so place it out of PHP content.

3.

Enable Infusionsoft plugin

The final step is to enable the Infusionsoft plugin in your Post Affiliate Pro. When active, you have to configure the plugin - it will ask you for API Key and for your account name.

The API key can be found in your Infusionsoft> Admin> Settings> Application> Encrypted Key. Just copy the value and paste it to the plugin.

The account name is your Infusionsoft account name, found in Your Accounts section right after you login to your Infusionsoft. The account name is also used in all your Infusionsoft links as a subdomain, e.g. your product links.
That's it. Save your settings and you are done with the integration.

4.

Recurring payments

If you want to track recurring payments as well, you can achieve that with Billing Automation in Infusionsoft and Lifetime Commissions plugin in Post Affiliate Pro.

The first step would be to navigate to Infusionsoft > E-Commerce > Settings > Billing Automation and create a new rule, to call a URL for every completed order:

http://URL_TO_PostAffiliatePro/plugins/Infusionsoft/infusionsoft.php

Save it and now enable Lifetime Commission plugin in your Post Affiliate Pro. That's it. Recurring commission will now be tracked as well.


Do not forget to integrated your landing pages with the click tracking code to make it all working.