Track Form Conversions

Capture referrals through your HubSpot Forms


Contact Support for Easy Setup

Referral Rock's support team can add conversion tracking to your form for you.

Submit a request. Prior to submitting, ensure the Referral.js SDK is installed on your site.

If you want to set it up yourself, use the guide below.


Tracking when a referral fills out submits a HubSpot form is easy with our conversion script.

To setup this conversion script you will need to be able to add JavaScript code to the <head> section of the webpage your form is on.


Referral.js SDK Required

The website must have the Referral.js SDK installed to track conversions.

Setup & Testing

Watch the video above to learn how to setup and test your tracking on your HubSpot form. Then use the recipe and example script below to create a script for your forms.

As you determine what data to save with your referral, keep in mind it is usually only necessary to save name, email, and an amount (if applicable) in Referral Rock. The Send Referrals to Contacts will add referral data to the contact in HubSpot, and you can use our HubSpot Customers to Referrals integration to add additional HubSpot property to the referral in Referral Rock if needed.

HubSpot is where all your data lives, so it's generally not needed to have additional form or HubSpot data in Referral Rock about the referral.

Script Recipe to Build Script

Base Script for You to Modify

Use the below script to customize parameters on lines 13 thru 24 to your form's fields. Use the video for instructions on how to do this.

window.addEventListener('message', function (event) {
    if ( === 'hsFormCallback' && === 'onFormSubmit') {
        var rawFormData =
        var formData = {};
        for (var i = 0; i < rawFormData.length; i++) {
            formData[rawFormData[i].name] = rawFormData[i].value;

        window.referralJS = ((window.referralJS !== null && window.referralJS !== undefined) ? window.referralJS : {});
        window.referralJS.conversion = {
        debug: "false",
        parameters: {
        firstName: formData.firstname,
        lastName: formData.lastname,
                    "textfield1": formData.fieldname1,
                    "textfield3": formData.fieldname2,
                    "textfield2": formData.fieldname3,
                    "dropdownfield4": formData.fieldname4,
                    "dropdownfield5": formData.fieldname5,