Changing default date range in Google Analyics?

10,778

Solution 1

Google Analytics allows you to set the default date range to the the last 7, 14, 28, or 30 days. You can access this setting from the User Settings which is found in the "Overflow Menu" (vertical three dots):

In addition, some people have noticed that if you bookmark a specific set of dates, those dates end up in the URL. Unfortunately, if you create a bookmark with a specific set of dates, those dates will be static and not change. You will never see new data.

However you can create a javascript bookmark (bookmarklet) that dynamically calculates the dates that should be in the URL and sends you to the URL. I have found three examples of this done for Google Analytics for this purpose.

http://whiletruecode.com/post/change-the-default-google-analytics-date-range-with-a-bookmarklet

https://stackoverflow.com/questions/7509010/bookmark-with-date-in-the-url

http://ratafia.info/post/70509179/bookmarklet-to-show-todays-stats-in-google-analytics

EDIT: Some of the above links are out of date (Google changed the URL format of dates in Analytics URLs at some point). I created a page that can on my site that can be bookmarked with your Google Analytics report id to get a wide variety of links for various time periods: http://ostermiller.org/calc/ga.html

Solution 2

There's no other way than using a bookmarklet (or browser plugin/extension). I tried the bookmarklet examples above, but none seemed to work for me.

The solution in the first link should work exactly like mine, but for some reason it doesn't. The other 2 links are outdated as Google Analytics URL structure has changed.

The "easiest" way I found to make a bookmarklet works like this:

  1. Log in to your Google Analytics account
  2. Look at the URL, it should be something like https://www.google.com/analytics/web/?hl=en&#home/a12345678w12345678p12345678/
  3. Copy the last portion of the URL, in the example it's a12345678w12345678p12345678
  4. Open a text editor, copy & paste this code on a new file you can call analytics.html

    <html>
    <head></head>
    <body><a target="_blank" href="javascript:(function(){function d(a){a=String(a);a.length<2&&(a='0'+a);return a}var c=new Date,b='';b+=c.getFullYear();b+=d(c.getMonth()+1);b+=d(c.getDate());location.href='https://www.google.com/analytics/web/?#report/visitors-overview/a12345678w12345678p12345678/%3F_u.date00%3D'+b+'%26_u.date01%3D'+b+'/=';})();">Google Analytics</a>
    </body>
    </html>
    
  5. Replace a12345678w12345678p12345678 in the file with the code you copied at step 3

  6. Save the file and open it with your browser (tested with Chrome, Firefox and Safari on Mac OSX)
  7. Drag the link to your bookmarks bar

Don't delete/move/rename the HTML file if you're using Chrome or Firefox, for some reason they need it even after you've added the bookmarklet.

Share:
10,778

Related videos on Youtube

Tabcina
Author by

Tabcina

Updated on September 18, 2022

Comments

  • Tabcina
    Tabcina over 1 year

    Is there a way to change the default date range of 31 days in GA? After changing it and clicking apply, only the current report changes? Next time I use GA, 31 days again???

    Google analyitics date custom report date range

    Google analyitics date custom report date range drop down

    Here is documentation on GA date range.

  • Basj
    Basj almost 7 years
    On your page linked page @StephenOstermiller, you wrote By default Google Analytics shows you the last 30 days of data when you log in. Now (2017) it seems to be 7 days by default, which is far too small. Is there a new way to change this default setting now in the new Analytics interface, in 2017 ?
  • Stephen Ostermiller
    Stephen Ostermiller almost 7 years
    @Basj I've updated this anwser. Now GA does allow some settings for the default date range.
  • Basj
    Basj almost 7 years
    Wonderful @StephenOstermiller !
  • Basj
    Basj almost 7 years
    Would be nice if we could include today by default (currently by default, it's the past x days). Do you think it's possible @StephenOstermiller ?
  • Stephen Ostermiller
    Stephen Ostermiller almost 7 years
    @Basj They don't have a setting for it. My page that is linked in the answer hourly reporting links that contain today. I didn't include them for full day reports because it doesn't usually make sense to compare a full day to a partial day.