HubSpot leads integration
Besides other features, HubSpot offers you a way to track custom forms. The integration of these forms will help you track lead commissions.
The integration uses the form’s ‘onBeforeFormSubmit’ function.
The standard form code looks like this:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
portalId: "1234567",
formId: "123c30ab-f09e-4c9a-ae7f-123e456f7f89"
});
</script>
The sale (lead) tracking code will be placed to the ‘onBeforeFormSubmit’ function mentioned above, like this:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
portalId: "1234567",
formId: "123c30ab-f09e-4c9a-ae7f-123e456f7f89",
onBeforeFormSubmit: function ($form, submissionValues) {
var email = '';
submissionValues.forEach(function(currentValue, index, arr){
if (currentValue.name == "email") {
email = currentValue.value;
}
});
var sale = PostAffTracker.createSale();
sale.setOrderID(email);
sale.setProductID('__Form name/Id here__');
sale.setData1(email);
PostAffTracker.register();
}
});
</script>
In case you need help with this sale/lead tracking code, feel free to get in touch with us.
Click tracking
Do not forget this important step. The code added to HubSpot forms requires the click tracking code to be present in the same page. Add the click tracking code anywhere to the page with your HubSpot form – it does not matter if you place it before or after the HubSpot form’s code.
Join HubSpot's Affiliate Program to earn commissions promoting a leading marketing and sales platform. Enjoy 15% recurring or 100% flat commissions, worldwide reach, and no minimum payouts. Leverage PPC, banners, and more for promotion. Sign up now for lucrative opportunities and comprehensive support!
Effortlessly integrate your e-commerce site with Post Affiliate Pro and boost your affiliate program's success. Our expert team ensures seamless integration with your payment processor, handling technical issues along the way. Enjoy a free trial and free integration service, saving you time and maximizing your ROI. Join now and experience top-notch affiliate management with over 500 integration options.