Skip to main content
Privy supports the use of Liquid variables in your custom conversion JavaScript (JS). These variables allow you to inject information related to a signup event into your custom JS code.

Supported variables

The following variables are supported in custom conversion JS for displays using Privy’s modern widget:
  • {{ contact.email }} — The email address of the contact who just signed up.
  • {{ contact.first_name }} — The first name of the contact who just signed up.
  • {{ contact.last_name }} — The last name of the contact who just signed up.
  • {{ contact.name }} — The contact’s full name, generated from the submitted first and last name.
  • {{ campaign.id }} — The ID of the display associated with the signup.
  • {{ signup.coupon_code }} — The coupon code that was shown to the contact who just signed up. This variable is only populated when the signup produced a coupon code.
  • {{ contact.custom_fields.sms_opt_in }} — The SMS opt-in value submitted by the contact.
  • {{ contact.custom_fields.phone }} — The phone number submitted by the contact. The personalization variable menu inserts this variable. Existing snippets using {{ contact.phone_number }} remain supported as a backward-compatible alias.
  • {{ contact.custom_fields.<field_identifier> }} — The value submitted for a custom field, including radio buttons, checkboxes, and Mini Quiz answers. For example, use {{ contact.custom_fields.favorite_color }} for a custom field with the identifier favorite_color.

Variable requirements + limitations

The following requirements and limitations apply to conversion JS variables:
  • Conversion JS variables are only populated with data collected during the current signup event.
  • A custom field variable must use the field’s exact identifier. You can select available fields from the personalization variable menu in the custom conversion JS editor.
  • The full {{ contact.custom_fields }} object cannot be used.

Include variables in your code

Liquid variables and their associated attribute values are included in your code by applying a specific format to the custom JavaScript snippet. Typical use cases include: Print console code example ​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.

Redirect and pass signup data

You can include the display ID when redirecting a visitor after signup. For example: