Privy now supports the use of liquid variables in your custom conversion javascript. Liquid variables allow you to inject information related to the contact that just signed up or the campaign they signed up for into your custom code.
We currently support the following liquid variables:
- {{contact.email}} — email address of the contact that just signed up
- {{contact.first_name}} — first name of the contact that just signed up
- {{contact.last_name}} — last name of the contact that just signed up
- {{signup.coupon_code}} — coupon code shown to the contact that just signed up
- {{campaign.id}} — id of the campaign that was just signed up for
Custom fields are also supported:
- {{contact.custom_fields.zip_code}} – the zip_code field of the contact, if available. Otherwise, the value will be null.
The following notes and limitations apply to custom fields:
- The custom field variable must exactly match the name of the field in the Privy form.
- The value `{{contact.custom_fields}}` cannot be used; only individual custom fields can be accessed.
- Some custom fields may be available for the contact even if the user did not fill them out – they may be available from prior signups.
Here are a few examples of how you can use these liquid variables:
If a user named “Joe Smith” with the email “joesmith@example.com” just signed up, the above code will print “Joe Smith (joesmith@example.com) just signed up!” to the console.
The above code will redirect the user after signing up and pass the campaign id as a URL parameter to the new page.