track google documentsHow do you know if the Word document you wrote in Google Docs has been read by the boss or not ?   Or how do you track the number of people who opened your Google Docs document that you published a public web page.

Where did the traffic come from? How long the visitors stayed? Such data is easy to track with Google Analytics but unfortunately, Google won’t let you insert JavaScript code into Google Documents. So here’s a simple workaround to help you track visitors to your documents in Google Docs.

Add Document Tracking to Google Docs:

The idea is simple. Instead of adding JavaScript to your Google Docs pages, you will will insert a tracking pixel image (visible or hidden) somewhere in the body of your document. When a recipient opens that document, the action is registered as a visit by the tracking code. Here are the steps involved:

Step 1. Go to statcounter.com (or any web statistics program) and register for a free account. Under “Install Code”, choose the following options:

Invisible Counter -> Google Pages -> HTML only counter. Statcounter will now generate some HTML code enclosed in a <div> tag. Strip everything except the IMG tag such that your final code looks something like this:

<img src=”http://c46.statcounter.com/3732481/0/e1fdff4b/1/” height=”1″ width=”1″ border=”0″ alt=”For Traffic Stats in Google Docs” />

google-docs-html

Step 2. Open the Google Docs document that you want to track. Select “Edit HTML” option from the Edit menu of Google Docs toolbar. Now copy-paste the HTML tracking code we generated in step 1 and save the document.

google-docs-code

You’re done. When people open the document inside Google Docs or as a public web page, they will be connected to the Internet and hence their visit will be registered by statcounter.

You get to know the exact date time when the document was accessed, the physical location of the reader, the duration of his stay and some other details like browser, OS, ISP, etc. Here’s a sample tracking report generated by my stats program.

tracking google docs

Statcounter is also integrated with Google Maps to help you easily visualize the location of Google Docs visitors. And you can use the same technique to track email messages.

Update: The above trick is for Word documents in Google Docs. If you like to track visitors to your spreadsheets in Google Docs, you may write a Google Gadget integrated with Google Analytics and insert that into your spreadsheet.