How can I track my WordPress user logins?

How to track user logins on my WordPress website

In order to track user logins form your website, you need to add the data to the user profile:

Paste the below snippet inside the page/file to add a custom tag. For example: use this to send us a signal when a user logs in to your system. We will add that information to visitor profiles. Send us login events; email addresses, usernames, LoginID, etc.

Make sure that: a. the default LeadBoxer javascript loads before the execution of below script b. the default LeadBoxer javascript should not contain the 'defer' tag.

<script type="text/javascript">
// define variables
<?php 
    $user_info  = wp_get_current_user();
    $user_login = $user_info->user_login;
    $user_email = $user_info->user_email; 
?>

// define an empty variable called 'map' 
var map = new OTMap();

//define one or multiple properties to be added to the visitor profile 
map.put("LoginName", "<?php echo $user_login; ?>"); 
map.put("email", "<?php echo $user_email; ?>"); // optional additional property

//send (submit) the data to LeadBoxer 
OTLogService.sendEvent("Login added", map, false);

</script>

Still need help? Contact Us Contact Us