Skip to content

Instantly share code, notes, and snippets.

@artnc
Created August 12, 2013 00:04
Show Gist options
  • Save artnc/6207462 to your computer and use it in GitHub Desktop.
Save artnc/6207462 to your computer and use it in GitHub Desktop.
Open Google Analytics with custom date range
javascript:(function(){var date=new Date(),month=date.getMonth()+1,day=date.getDate(),today=date.getFullYear()+(month<10?"0":"")+month+(day<10?"0":"")+day;window.open("https://www.google.com/analytics/web/?hl=en#dashboard/qPO8hKRkSyeyLrgrfA-MMQ/a30163394w56549290p57645749/%3F_u.date00%3D20120329%26_u.date01%3D"+today+"/","_blank");}());
(function() {
var
date = new Date(),
month = date.getMonth() + 1,
day = date.getDate(),
today =
date.getFullYear()
+ (month < 10 ? "0" : "")
+ month
+ (day < 10 ? "0" : "")
+ day;
window.open("https://www.google.com/analytics/web/?hl=en#dashboard/qPO8hKRkSyeyLrgrfA-MMQ/a30163394w56549290p57645749/%3F_u.date00%3D20120329%26_u.date01%3D" + today + "/","_blank");
}());
javascript:(function(){var date=new Date(),month=date.getMonth()+1,day=date.getDate(),today=date.getFullYear()+(month<10?"0":"")+month+(day<10?"0":"")+day;window.open("https://www.google.com/analytics/web/?hl=en#dashboard/qPO8hKRkSyeyLrgrfA-MMQ/a30163394w56549290p57645749/%3F_u.date00%3D"+today+"%26_u.date01%3D"+today+"/","_blank");}());
(function() {
var
date = new Date(),
month = date.getMonth() + 1,
day = date.getDate(),
today =
date.getFullYear()
+ (month < 10 ? "0" : "")
+ month
+ (day < 10 ? "0" : "")
+ day;
window.open("https://www.google.com/analytics/web/?hl=en#dashboard/qPO8hKRkSyeyLrgrfA-MMQ/a30163394w56549290p57645749/%3F_u.date00%3D" + today + "%26_u.date01%3D" + today + "/","_blank");
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment