Customer Identification and Enrichment

Once you have deployed the Convizit JavaScript tag, you may add JavaScript code to your website that associates your customer IDs with known visitors. You may optionally include additional data fields that Convizit will save along with each visitor. This may make it easier to consume the user activity data available in your systems.

This page describes how to implement the following code snippets:

Client-Side Customer Identification

If you want Convizit to include your own customer IDs when delivering your visitor activity data, you need to execute the following JavaScript function in your website whenever a visitor logs in or registers:

				
					convizit.identify('<your_customer_id>');
				
			

Replace <your_customer_id> with JavaScript code that resolves to a unique identifier for the current visitor, such as the customer ID that appears in your database or a hash of the customer email address (for data privacy reasons, it is not recommended to use actual email addresses or any other type of PII).

When your customer ID is associated with website visitors in this way, all user activity data supplied by Convizit will also include your customer ID.

Saving Additional Customer Details

After associating a customer ID using convizit.identify() you may also send Convizit additional data fields that Convizit will save along with each visitor record. This may make it easier to consume the user activity data in your own systems (again, it is recommended to only provide hashed values of fields containing PII). To do so, execute the following JavaScript function in your website:

				
					convizit.set('visitor_details', {
    $email: '<hashed_email_address>',
    $first_name: '<hashed_first_name>',
    $last_name: '<hashed_last_name>',
    $date_time: '<date_time>',
    some_number_field: <some_numeric_value>,
    some_boolean_field: <true|false>,
    ...
});
				
			

Notes:

  • All fields are optional.
  • The four field names that start with $ are “reserved” field names.
  • The $date_time field is intended for any date/time related to the individual customer. Common uses include the date/time that the customer first appeared in your customer database or the customer’s birthday. It should be provided in Unix epoch time format.
  • Up to 50 fieldname:value pairs may be specified.
  • Field names must be strings (maximum 255 characters).
  • Values must be of type string (maximum 255 characters), number or Boolean.

Retrieving Saved Customer Details

If you would like to be able to access, via client-side JavaScript, the customer details that you previously associated with the current website visitor (using convizit.set(‘visitor_details’,{…})), use the following JavaScript function:

				
					var userProfile = convizit.get('visitor_details', function callback(visitorDetails){});
				
			

This function returns an object containing the available fieldname:value pairs for the current website visitor:

				
					{
    'visitor_id': '<string>',
    'customer_id': '<string>',
    '$email': '<string>',
    '$first_name': '<string>',
    '$last_name': '<string>',
    '$date_time': '<string>',
    'some_number_field': <number>,
    'some_boolean_field': <true|false>,
    ...
}
				
			

Where:

  • visitor_id is Convizit’s unique identifier for this visitor.
  • customer_id is your identifier for this customer, as previously associated with this visitor using the convizit.identify() function.
  • all other field names and values are those previously associated with this visitor using the convizit.set(‘visitor_details’,{…}) function.
This website uses cookies. Cookies remember you so we can give you a better online experience. Learn more.