Skip to content

Track when people came online and went offline on WhatsApp

Notifications You must be signed in to change notification settings

utkarsh914/whatsapp-stalker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

If you're not okay with the script thing, See chrome extension. Go here

Whatsapp-Stalker

Track when people came online and went offline on WhatsApp Web It can track only a single target at a time. So, don't hop from one person's chat to another. Leave it open on target's only. Don't worry! It won't steal your chats. I'm a good person :p

How to use:

  1. Open whatsapp web, connect to your whatsapp account

  2. Open browser console, paste the script in track.js and hit ENTER.

  3. Two buttons to download log as csv and to toggle stalking process will appear in the header.

  4. Open the person's chat and leave the tab open for as long as you want.

  5. Script will log whenever person comes online or goes offline along with the online duration.

  6. Log will be shown on the console and can also be downloaded as csv.

    PS: Allow whatsApp web's notifications to receive a notification whenever target's status changes

Optionally:

You can use bookmark method for easier access. Create a bookmark with url as below. Place the bookmark on bookmark bar and set bar's setting to always show.

header > div._24-Ff > div > div > span").textContent,b=document.querySelector("#main > header > div._24-Ff > div.zzgSd._3e6xi > span"),c=document.querySelector("#main > header > div._2YnE3 > div > img"),d=b?b.textContent:null,e=c?c.src:"https://img.icons8.com/ios-filled/50/000000/whatsapp.png",f=new Date,g=f.toLocaleTimeString() ", " f.toLocaleDateString();if(null===d&&!0===m){m=!1,k=new Date().getTime();const b=parseInt((k-j)/1e3),c=`${parseInt(b/60)} min and ${b%60} sec`;console.log(`${a}: ${g}, Went Offline`),console.log(`Duration: ${c}`);const d=new Date(j).toLocaleTimeString(),f=new Date(k).toLocaleTimeString();if(l =`${a},${d},${f},${c}\n`,i()){new Notification(`${a} went offline`,{icon:e,body:`from ${d} to ${f}\n Duration: ${c}`})}}else if(("online"===d||"typing\u2026"===d)&&!1==m){m=!0,j=new Date().getTime();const b=new Date(j).toLocaleTimeString(),c=new Date(k).toLocaleTimeString();if(console.log(`${a}: ${g}, Came online`),i()){new Notification(`${a} came online`,{icon:e,body:`Time: ${b}, ${c}\n`})}}}catch(a){}}function b(){try{n||(f(),h(),n=!0,i())}catch(a){}return o=setInterval(a,1e3),alert("Stalking!"),console.log("Stalking!"),alert("Provide permission if you want to get notifications when a user is online/offline.\t\t\n\nYou can turn notifications off later if you don't want to recieve them"),o}function c(a){a=encodeURI(a);let b=document.createElement("a");b.setAttribute("href",a),b.setAttribute("download","stalk_data.csv"),document.body.appendChild(b),b.click()}function d(){l="data:text/csv;charset=utf-8,Name,From,To,Duration\n"}function e(){c(l)}function f(){var a=document.createElement("button");a.textContent="GetCSV",a.style.padding="4px",a.style.margin="3px",a.style.border="1px solid black",a.onclick=e;var b=document.querySelector("#side > header");b.appendChild(a);var c=document.createElement("button");c.textContent="ResetCSV",c.style.padding="4px",c.style.margin="3px",c.style.border="1px solid black",c.onclick=d;var b=document.querySelector("#side > header");b.appendChild(c)}function g(){-1===o?(b(),this.textContent="Stop"):(clearInterval(o),o=-1,alert("Stopped Stalking"),console.log("Stopped Stalking"),this.textContent="Stalk")}function h(){var a=document.createElement("button");a.style.padding="4px",a.style.margin="2px",a.style.border="1px solid black",a.textContent="Stop",a.onclick=g;var b=document.querySelector("#side > header");b.appendChild(a)}function i(){if(!("Notification"in window))return!1;return!("granted"!==Notification.permission)||void("denied"!==Notification.permission&&Notification.requestPermission(function(a){if("granted"===a)return!0}))}var j,k,l="data:text/csv;charset=utf-8,Name,From,To,Duration\n",m=!1,n=!1,o=-1;b()}();">
javascript:void function(){function a(){try{const a=document.querySelector("#main > header > div._24-Ff > div > div > span").textContent,b=document.querySelector("#main > header > div._24-Ff > div.zzgSd._3e6xi > span"),c=document.querySelector("#main > header > div._2YnE3 > div > img"),d=b?b.textContent:null,e=c?c.src:"https://img.icons8.com/ios-filled/50/000000/whatsapp.png",f=new Date,g=f.toLocaleTimeString() ", " f.toLocaleDateString();if(null===d&&!0===m){m=!1,k=new Date().getTime();const b=parseInt((k-j)/1e3),c=`${parseInt(b/60)} min and ${b%60} sec`;console.log(`${a}: ${g}, Went Offline`),console.log(`Duration: ${c}`);const d=new Date(j).toLocaleTimeString(),f=new Date(k).toLocaleTimeString();if(l =`${a},${d},${f},${c}\n`,i()){new Notification(`${a} went offline`,{icon:e,body:`from ${d} to ${f}\n Duration: ${c}`})}}else if(("online"===d||"typing\u2026"===d)&&!1==m){m=!0,j=new Date().getTime();const b=new Date(j).toLocaleTimeString(),c=new Date(k).toLocaleTimeString();if(console.log(`${a}: ${g}, Came online`),i()){new Notification(`${a} came online`,{icon:e,body:`Time: ${b}, ${c}\n`})}}}catch(a){}}function b(){try{n||(f(),h(),n=!0,i())}catch(a){}return o=setInterval(a,1e3),alert("Stalking!"),console.log("Stalking!"),alert("Provide permission if you want to get notifications when a user is online/offline.\t\t\n\nYou can turn notifications off later if you don't want to recieve them"),o}function c(a){a=encodeURI(a);let b=document.createElement("a");b.setAttribute("href",a),b.setAttribute("download","stalk_data.csv"),document.body.appendChild(b),b.click()}function d(){l="data:text/csv;charset=utf-8,Name,From,To,Duration\n"}function e(){c(l)}function f(){var a=document.createElement("button");a.textContent="GetCSV",a.style.padding="4px",a.style.margin="3px",a.style.border="1px solid black",a.onclick=e;var b=document.querySelector("#side > header");b.appendChild(a);var c=document.createElement("button");c.textContent="ResetCSV",c.style.padding="4px",c.style.margin="3px",c.style.border="1px solid black",c.onclick=d;var b=document.querySelector("#side > header");b.appendChild(c)}function g(){-1===o?(b(),this.textContent="Stop"):(clearInterval(o),o=-1,alert("Stopped Stalking"),console.log("Stopped Stalking"),this.textContent="Stalk")}function h(){var a=document.createElement("button");a.style.padding="4px",a.style.margin="2px",a.style.border="1px solid black",a.textContent="Stop",a.onclick=g;var b=document.querySelector("#side > header");b.appendChild(a)}function i(){if(!("Notification"in window))return!1;return!("granted"!==Notification.permission)||void("denied"!==Notification.permission&&Notification.requestPermission(function(a){if("granted"===a)return!0}))}var j,k,l="data:text/csv;charset=utf-8,Name,From,To,Duration\n",m=!1,n=!1,o=-1;b()}();

Click the bookmark to activate the script anytime with ease.

made with: https://chriszarate.github.io/bookmarkleter/