Skip to content

Instantly share code, notes, and snippets.

@maxkandler
Last active December 23, 2015 02:49
Show Gist options
  • Save maxkandler/6569481 to your computer and use it in GitHub Desktop.
Save maxkandler/6569481 to your computer and use it in GitHub Desktop.
Script to extract all mobile vitsits from your (synced) Chrome history. Run this script in the dev-tools of chrome://history-frame.
// Script to extract the mobile visits from the the synced Chrome history.
//
// INSTRUCTIONS:
// 1. Open chrome://history-frame
// 2. Copy & Paste the code below into the console
// 3. Run and wait (it will evaluate all visits dating back to 12. September 2013)
// 4. Success
var mobileVisits;
var endDate = new Date('2013','08', '12');
(function getVisits() {
console.log("Start...");
if(historyModel.visits_[historyModel.visits_.length-1].date > endDate){
document.getElementById('older-button').click();
setTimeout(getVisits, 2000);
}else{
console.log("Done!")
evaluateVisits();
}
}());
function isMobileVisit(visit){
if(!(visit instanceof Visit)){
return false;
}
if(visit.date < endDate){
return false;
}
if(visit.deviceType == "phone"){
return true;
}
return false;
}
function evaluateVisits(){
var visits = historyModel.visits_;
console.log("total visits: "+visits.length);
mobileVisits = visits.filter(isMobileVisit);
console.log("total visits: "+mobileVisits.length);
console.log(mobileVisits);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment