July 1, 2008

Google Docs Stats

Update (March 2012): This feature is no longer available. "We're phasing out Google Analytics support in our new editors, but we'll be working on alternatives to provide admins with more information about their doc's viewers."

If you publish documents at Google Docs and link them from web pages, you may wonder how many people actually view them. Google helps you find this information by placing a Google Analytics tracking code that can be connected to your account.

How to get traffic stats for your documents?

Just go to Google Analytics, create a new profile for http://docs.google.com and get the tracking code for that profile. You only need a small piece of the tracking code: the value displayed in bold below, which should be different for your account.

var pageTracker = _gat._getTracker("UA-84813-6")

Once you have that value, go to Google Docs Settings, enable "Track visits to my documents using Google Analytics" and paste the value in the input box for "Google Analytics tracking code".


What happens after enabling the integration with Google Analytics?

After a couple of hours, you should see some traffic data in your Analytics account:


You'll also find a confirmation that the visitor traffic is tracked with Google Analytics after you publish a document:


The list of Google services that integrate with Google Analytics includes: Google Sites, Project Hosting, iGoogle gadgets and hopefully the support will be extended to other services.

{ via Blogoscoped Forum }

22 comments:

  1. Neat! Hope to see Google Analytics supported in Picasa Web as well.

    ReplyDelete
  2. Will this work for spreadsheets also as the URL for spreadsheets is http://spreadsheets.google.com or do I need to create another profile?

    ReplyDelete
  3. Your Analytics tracking code is only added to published documents, not to spreadsheets or presentations.

    ReplyDelete
  4. @Ionut Alex Chitu
    Did you verify your own tracker code appeard in a freshly published Google Docs text document page? I could only find Google Docs own internal tracker code (UA-18065-1).

    The Google Docs Settings did remember my personal treacker code from last time this feature - briefly - appeared. I re-saved my code but alas...

    Please tell me I'm missing something (and what I'm missing ;)

    ReplyDelete
  5. >>Your Analytics tracking code is only added to published documents, not to spreadsheets or presentations.
    correct. But the URL for published spreadsheets is http://spreadsheets.google.com so will the code on http://docs.google.com track that too?

    ReplyDelete
  6. @Anonymous:
    That web address is not important and doesn't interfere with the tracking process.

    @Ahab:
    You're right. I can't find the profile ID in any published document.

    ReplyDelete
  7. @Ahab:
    I see what's going on. Google builds the Analytics code dynamically and obtains the profile ID from the document's ID.

    POST /MiscCommands HTTP/1.1
    command=getanalyticscode&docid=DOCUMENTID

    ReplyDelete
  8. @Ionut Alex Chitu
    One wonders why such an obfuscated scheme is used. I also wonder where the returned value of the req.send('command=getanalyticscode&docid=' + encodeURIComponent(docid)); is processed to initialise another tracker instance.

    In a discussion at blogoscoped ( http://blogoscoped.com/forum/126270.html#split ) with Tony Ruscoe he showed ( http://blogoscoped.com/forum/126270.html#id126353 ) how a simple modifiction of the Analytics script would be enough to have two tracker instances.

    It seems they are using such an elaborate workaround, but for what purpose...?

    ReplyDelete
  9. Very nice. However, sad to know that Google Apps (Docs) doesn't support this track option...

    ReplyDelete
  10. Sad too, it would have been really nice to have it in Google Apps...

    ReplyDelete
  11. What a great feature!

    ReplyDelete
  12. Having added the wrong analytics code to a document is there a way I can change it? It looks to be locked in there.

    ReplyDelete
  13. Seesm to work only for doc, not for spreadsheet or presentation or uploaded pdf (at least there is no way to see that they are tracking, the message only shows for doc - why the **** does every format have totally different look and feel for publish?). of limited usefulness

    ReplyDelete
  14. What a great "doesn't work" feature.... :(

    ReplyDelete
  15. Spreadsheet support would be marvellous!

    Also, it would be great to find a text like this, explaining the setup procedure for docs.google.com, where one would expect it (i found out about this feature by a link advertising it somewhere in my google account, so a little how-to like this one would be cool to be placed there).
    I spent quite some time until i found this text (just to find out that spreadsheets are not supported, sadly).

    ReplyDelete
  16. Great I've set this up. Quick question I've allowed access to a stored zip file with in my google docs. Do you know if these settings will track the traffic on the downloads to this zip file???

    ReplyDelete
  17. Does not work. Google Analytics says that the site is not verified. I've put the tracking ID in to Google Docs. I've also tried https in the website address too.

    ReplyDelete
  18. Does not work for spreadsheets. While this seems to be clear with a bit of searching, I have not found any reason or expected date when it may be available.

    It's not accurate to say that "Google Docs" can be tracked, since there are more types of documents than just the "document" type.

    :(

    ReplyDelete
  19. The GA tracking feature is no longer available in the https://docs.google.com/settings – has it gone with the switch to new interface?

    ReplyDelete
  20. The GA tracking feature is no longer available in https://docs.google.com/settings – has it gone with the new interface?

    ReplyDelete
  21. According to Google:

    "We're phasing out Google Analytics support in our new editors, but we'll be working on alternatives to provide admins with more information about their doc's viewers."

    ReplyDelete
  22. It never worked for me, buy it would have been sweet if it did. It's useful, please get it back.

    ReplyDelete

Note: Only a member of this blog may post a comment.