"Refer a Friend" + your custom form

How to get participants to join your "Refer a Friend" campaign using a custom form on your website

Fivos Stergiannis avatar
Written by Fivos Stergiannis
Updated over a week ago

The "Refer a Friend" template comes with its own form as part of the In-app Referral Widget™. However, if you would rather have participants join in a different way, you can do that too with a little bit of coding.

This is useful in several cases:

  • You have a web app and you want your users to see the In-app Referral Widget only after they have logged in.

  • Your landing page is built on Unbounce, Instapage or other similar CMS and you want participants to join the referral campaign only after submitting one of the forms on your website.

  • You want people to verify their email address before joining as participants in your referral campaign.

In such cases, you need to manually submit the participant to Viral Loops. 

Client-side submission

Firstly, make sure you have added the Viral Loops javascript embeddable widget snippet before the closing <body> tag in your page. You can get this snippet at the Installation step of your campaign wizard. 

After the form is submitted, run the identify method to add the participant to the campaign.

Server-side submission

If you want to add the new participants over the Web API, use the Registration method.

However, after that part, you will still need to run the client-side identify as before, so that the widget will load the user's unique referral URL and sharing options.

GDPR consent

If you want to capture GDPR consent as well, add the consents property in the user object. The Consent ID can be found in the Settings Page of the app, where the GDPR consents are added.

Note: This article does not apply to Squarespace pages, due to restrictions/limitations.

Did this answer your question?