Support » Plugin: Tidio Live Chat » document.tidioIdentify – Need help

  • Resolved ampedx

    (@ampedx)


    Could you guys explain more clearly what to write here? I use wordpress, I have no idea what to enter in order for the chat to recognize logged in users. Thanks

    <script>
    document.tidioIdentify = {
    distinct_id: ‘1’,
    email: ‘example@mail.com’,
    name: ‘John Doe’,
    city: ‘Denver’,
    country: ‘US’
    };
    </script>

Viewing 1 replies (of 1 total)
  • Hi,

    I solved the problem by adding this code in the header.php of the theme:

    
    <?php			
    	if( is_user_logged_in() ) {
    		$current_user = wp_get_current_user();
    			
    		$current_user_name = $current_user->user_firstname . " " . $current_user->user_lastname;
    		$current_user_id = $current_user->ID;
    		$current_user_mail = $current_user->user_email;
    ?>
    
    	<script>
    		var user_id = "<?php echo $current_user_id ?>"; // Set customer ID
    		var user_fullname = "<?php echo $current_user_name ?>";  // Set customer email
    		var user_email = "<?php echo $current_user_mail ?>";  // Set customer name
    
    		document.tidioIdentify = {
    		    distinct_id: user_id, 
    		    email: user_email,
    		    name: user_fullname,
    		};
    	</script>
    
    <?php } ?>
    

    Let me know if it works 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘document.tidioIdentify – Need help’ is closed to new replies.