A JS Bookmarklet To Instantly Check Page Traffic

This post is short, simple and useful.

Check Traffic For The Page You’re On

A common situation I find myself in - you’re reviewing a site and you land on a page and you think to yourself “I wonder how much traffic this page gets and I wonder where it comes from?” so you have to open up Google Analytics, filter through the pages report and find the URL. This post lets you do that process in one click.

Step 1: Put your GA profile id into this box

Say what? Which ID? Log into the Google Analytics profile you want to use and then copy and paste the number in the URL. It should look a little like this:

Copy and paste that number into this box:

Step 2: Drag and drop this JS bookmarklet into your bookmarks

GA Page Lookup

Note: the above link includes your GA profile id and is automagically updated based on the number you put in the box. Jquery! Magic!

When you click the bookmarklet on a page you’ll instantly be taken to Google Analytics on a page like this:

Step 3: Confused? Check out this 46 second video

This video walks you through exactly how to use the JS bookmarklet!

Want more JS Bookmarklets? Try these.

PS - in case you want the link and the above jquery magic is broken for some reason the URL I’m opening is simply this:

https://www.google.com/analytics/web/#report/content-pages/[GA-profile-id]/%3F_r.drilldown%3Danalytics.pagePath[url-encoded-pagepath]%26explorer-table.secSegmentId%3Danalytics.source/

Get blog posts via email

21 Comments

  1. Simple, but very useful.

    I dig it. Thanks for sharing!

    reply >
  2. This would be a great tool, alas when I tried it all of the pages returned had 0 visits. I'll have to keep playing and see if I can suss it out.

    reply >
  3. Tom Critchlow

    Hey Adi - if it's loading up the GA page correctly then I'm not sure where the issue lies... If you're seeing zero visits maybe your date range is set funny or perhaps you're in the wrong profile? I'd double check the profile ID and the page URL are correct

    reply >
    • Hi Tom. Tried it with a couple of personal accounts and it works a charm. Just the work one that's producing nothing. Guessing there must be something peculiar in how the account was setup or something. Great applet though, really useful.

    • Adi's problem is probably related to my comment.... hi likely uses custom URL in the _trackPageview call.

  4. Hi Tom,
    Slick little Bookmarklet.

    However, you should point out that the script only works for GA implementations that use standard calls to _trackPageview and it does not work for sites that use custom paths in the GA calls. It will only work when the real URL matches exactly how the GA calls the page in the _trackPageview Call.

    For example, something like this in the page will not work with your results.


    _gaq.push(

    ['page._trackPageview',['', 'trackingGA', 'suministros-proteccion-laboral', 'equipos-proteccion-individual-epi', 'proteccion-ocular-facial', 'pantallas-proteccion-visual-facial', 'general-optica', 'pantalla-facial', 'idp-974687821-ide-974308340-idc-1125044-p.html'].join('/')],

    ['global._trackPageview',['', 'trackingGA', 'ES', 'suministros-proteccion-laboral', 'equipos-proteccion-individual-epi', 'proteccion-ocular-facial', 'pantallas-proteccion-visual-facial', 'general-optica', 'pantalla-facial', 'idp-974687821-ide-974308340-idc-1125044-p.html'].join('/')]

    );




    I'll look into seeing if there is a way to pull the actual pageview call from the _gat object to use to pass to GA.

    reply >
  5. Tom Critchlow

    Michael - you're right that the bookmarklet won't work in this implementation though I don't think it's a particularly common setup (and hopefully most people with that advanced setup will be advanced enough to know that it will break this JS...)

    Thanks for adding though!

    reply >
    • I agree, very few sites use the Custom URL feature.

      Even Google's own services have problems with the advanced setup. For example, In-Page Analytics inside GA is 100% useless if you use a custom setup and they don't mention that anywhere in the interface.

      I doubt that there is a hack to find the custom URL easily, but if I do, I'll pass it over to you.

  6. Just tried the tool. Love it Tom!! Thank you, this will be an easy timesaver - and something that will be fun to show off to people :-)

    -Dan

    reply >
  7. Thanks Tom, this is really useful and a big time saver!
    Walid

    reply >
  8. This is awesome. Well done Distilled team :)

    reply >
  9. That ist a great article. I will try this on my page

    reply >
  10. Thank you ! It will save me a lot of time for my reports, greats !

    reply >
  11. Love this bookmarklet. I made a slight tweak in order to show keyword referrals, as opposed to source as a secondary dimension. This allows for quickly spot checking top driving keywords to any given page.

    All you need to do is update the end of the code from .source to .keyword

    javascript:location.href="https://www.google.com/analytics/web/#report/content-pages/XXXX--YOUR GA PROFILE ID--XXXX/%3F_r.drilldown%3Danalytics.pagePath"+encodeURIComponent(":"+location.pathname)+"%26explorer-table.secSegmentId%3Danalytics.keyword/";

    reply >
  12. Awesome. Totally Awesome. I love bookmarklets and I love Google Analytics. This one is incredible. Thanks for sharing.

    Any chance anybody can share how to make the bookmarklet open the new Google Analytics page in a new tab/window? It's a bit of a pain to lose the page.

    Thanks!

    reply >
  13. Thanks - Great tool! It works on most all of our client accounts. Can it be edited to open in a new tab/window?

    reply >
  14. Simple and powerful!

    Thanks for sharing it!

    reply >
  15. You can also include several sites in a single bookmarklet:
    https://plus.google.com/u/0/101181438692969201157/posts/TnX82y1RxVZ

    reply >
  16. That was just too easy - another gem - thanks Tom!

    Scott

    reply >
  17. Hi Chaps,

    First of all, kudos for the Bookmarklet Tom, very handy!

    I too saw no data when i tried it on a site of mine but i think this was being caused by the Default Page setting in Google Analytics - does your analytics set up report your homepage is http://www.domain.com/index.php and internals as http://www.domain.com/folder/index.php

    if so, you can just append index.php to the end of the pathname and that should work.

    Making the following changes worked for me:

    javascript:location.href="https://www.google.com/analytics/web/#report/content-pages/a6037597w11662216p12203754/%3F_r.drilldown%3Danalytics.pagePath"+encodeURIComponent(":"+location.pathname+"index.php")+"%26explorer-table.secSegmentId%3Danalytics.source/";

    reply >

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>