Skip to main content
All CollectionsGetting StartedInstallation
Sona Identify () for Web Apps
Sona Identify () for Web Apps
Updated over 5 months ago

Sona provides an optional script that can be added to your website or app to send user data. This additional script makes it possible to connect the journey for users that visit the website and then subsequently submit registration information.

To implement the Sona Identify () script, your development team should dynamically populate the placeholders (USER_EMAIL, firstName, lastName , etc.) with actual user data from the application's database or session at runtime.

Step 1: Identify the Data Source

  • The values for email, id, leadId, firstName, lastName, and phone should come from authenticated user data available on your platform.

Step 2: Push Email

  • Email: It's essential to push an email identifier for accurate user identification. Replace 'USER_EMAIL' with the user’s actual email address.

  • Optional Fields: Additional information like firstName, lastName, leadId, and phone can provide enhanced tracking and are beneficial if they’re available.

Step 3: Populate the Values Dynamically

  • Insert values by dynamically passing user-specific data within the HTML <script> tag.

  • Ensure these values are securely accessed from your backend or session data to prevent exposing sensitive information in the script.

Example:

If using a templating language, it might look like this:

<script type="text/javascript">
sona.identify({
email: '<%= currentUser.email %>', // Replace dynamically

leadId: '<%= currentUser.leadId %>', // Optional
firstName: '<%= currentUser.firstName %>', // Optional
lastName: '<%= currentUser.lastName %>', // Optional
phone: '<%= currentUser.phone %>', // Optional
});
</script>

Or, if using JavaScript variables directly:

<script type="text/javascript">
sona.identify({
email: user.email, // Replace dynamically

leadId: user.leadId, // Optional
firstName: user.firstName, // Optional
lastName: user.lastName, // Optional
phone: user.phone, // Optional
});
</script>

Note:

Please ensure that the data is securely managed and sent according to data protection practices for your organization, especially if displaying user data within front-end scripts.

Did this answer your question?