Referral link on a thank you page

Last updated: April 12, 2021 Written by: Avatar Justyna
share
Table of contents
share
Table of contents

Referral links are links to your landing page that contain a unique user ID. This instruction will show you how to add a referral link to a conversion page to track a landing page referral process by those who filled out a form.

Add JavaScript codes

1. Log in to your Landing account and go to the Dashboard of your landing page. Navigate to the JavaScript Code tab and click Add script.

add script

2. Name the script and in the field Content, paste the following code: 

<script>
function generateId() return Math.floor(Math.random() * 10000000000);
}
document.querySelector('.widget-input-button').onclick = function () document.querySelector('[name=user_id]').value = generateId();
};
</script>

Choose the Body bottom position on the Main page. Click on Add.

add java main page

3. Add a second script. Paste the code indicated below:

<script>
document.querySelector('.reflink-area').innerHTML = 'your_address_here.com?user_id=' + conversion.user_id;
</script>

Replace your_address_here.com with the URL of a landing page, where you add the code, such as mylanding.com.

Choose the Body bottom position on the Conversion page. Click on Add.

java on conversion page

Edit form and conversion page

1. Go to the editor of your landing page. Click on the Form widget and go to its Settings. In the Form fields tab, click on + Add element and choose Hidden.

add hidden field

2. Click on Additional options and name the attribute user_id. Save and close.

user id

3. Navigate to the conversion page (Thank You Page).

conversion page

4. Add a Text widget and in a toolbar, add a reflink-area class to it. The referral link will appear here.

add class

5. Publish the landing page.

After the form is correctly filled and submitted, a 10-digit user code will be generated and stored in the hidden user_id field and the lead. The same code will also be added to the link that will appear on the conversion page. The user should use this link to recommend your landing page further.

referral link
share

Was this manual helpful?