How to run scripts when the Signup Form is submitted?
Prefinery provides you the ability to easily execute custom code or scripts when the signup form is submitted. This is particularly useful for integrating 3rd-party analytics tools with your campaigns like Segment, or to add each new user in your project into your own mailing list on platforms like Mailchimp.
While Prefinery already easily integrates with popular analytics tools like Google Analytics and Facebook Pixel, we're providing you a way to use your own custom scripts so you can do more after the user submits your form.
Installing Code
- 1
-
From your project dashboard, navigate to Signup Form, then select the JS tab.
-
- 2
-
In the Conversion Tracking Code box, paste in your custom script.
-
- 3
-
Hit Save when done.
Variables
Prefinery let's you access data for the user who submitted the form with your custom script in the variable named prefinery_data
.
Here are the currently supported values:
prefinery_data.user.email |
The person's email address |
prefinery_data.user.profile.first_name |
The person's first name |
prefinery_data.user.profile.last_name |
The person's last name |
prefinery_data.user.referral_code |
The person's referral code |
prefinery_data.user.referral_link |
The person's referral link |
prefinery_data.user.created_at |
When the person was added to your campaign |
prefinery_data.user.id |
The created user's unique ID in the system |
Example Usage
<script> // Show email address of user who submitted the form console.log('Email: ' + prefinery_data.user.email); // Show prefinery_data object, which displays all data console.dir(prefinery_data); </script>
Here are other examples:
- Pass user data as redirect URL parameters on form submit
- Send event to Segment on form submit
- Add Prefinery user as Mailchimp subscriber on form submit
- Send event to Google Analytics on form submit
- Send event data to Facebook on submit button click
- How to add extra pages (bridge pages) after form-submit action before showing the referral page