SalesIQ Identity Update for Logged In Wordpress User
Hey folks,
SalesIQ does not automatically detect when a visitor logs in to WordPress and update their identity to match.
For example, if a client of ours visits the site and logs in, SalesIQ will not track them correctly by default.
The Solution
The solution to this is actually pretty simple:. Pleace the follow code into
File path: /wp-content/themes/astra-child/functions.php
- add_action('wp_footer', function() {
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$name = esc_js( $current_user->display_name );
$email = esc_js( $current_user->user_email );
?>
var $zoho = $zoho || {}; $zoho.salesiq = $zoho.salesiq || {}; $zoho.salesiq.ready = function() { $zoho.salesiq.visitor.name("<?php echo $name; ?>"); $zoho.salesiq.visitor.email("<?php echo $email; ?>"); };
<?php
}
});
If the user returns, they should still be correctly identified, even if they have not yet logged in.
Another trick is to use the siq_email and siq_name parameters for any links you email to clients.
eg.
http://www.yoursite.com?siq_email=ssmith@yoursite.com&siq_name=Sam Smith
The benefit of being table to correctly and quickly tag visitors goes beyond SalesIQ. It also means they are picked up correctly in the CRM and in Zoho Analytics imports.