Skip to main content
Track Google Spreadsheet Visitors with Google Analytics Code

Track Google Spreadsheet Visitors with Google Analytics Code

Learn How to Add Google Analytics Code to Google Spreadsheet and Help in Tracking Your Daily Visitors for Google Spreadsheet

Google analytics a better successful Google product to track online visitors. People find very useful for tracking user per visit on web pages. Now time all developers and designers use Google analytics for tracking per count of daily visitors. Tracking a Spreadsheet Views by Google analytics is compactable with 2 easy processes.

  • Can Embedded Google tracking code and Google Spreadsheet on Single web page.
  • Or can embedded the tracking code in Google Spreadsheet itself.

The first tricks are well-known by each and every developer and designer. So we will see out the second trick for adding tracking code in Google Spreadsheet. Google don’t provide the options for adding tracking code in Google spreadsheet but with given steps and tricks you will achieve the tracking of spreadsheet successfully on real time.

How to Insert Google Tracking Code in Spreadsheet?

Well, the answer is simple – YES, we will add tracking code in Image function with some tracking Script embedded in it, after adding the image in the spreadsheet cell, it will help us to enable the tracking of our Google spreadsheet. Some of the people thing that By inserting the Google tracking code in spreadsheet cell will also enable the tracking but let should I tell you, Its Not possible. The Spreadsheet cell accepts the cell data as print, not as a working client/server script.

Let get started –

1. Go to you Google analytics account and make a note copy of your Google analytics Tracking Id which will be an alphanumeric like UA-58745-85.

Create Google Analytics Account Now

2. Now open your Google spreadsheet which you want to track

3. Go to – Tools >> Script Editor >> and Copy & Paste the Following code into your script Editor.

function GOOGLEANALYTICS(gaaccount, spreadsheet, sheetname) {

var imageURL = [
"https://ssl.google-analytics.com/collect?v=1&t=event",
"&tid=" + gaaccount,
"&cid=" + Utilities.getUuid(),
"&z="   + Math.round(Date.now() / 1000).toString(),
"&ec="  + encodeURIComponent("Google Spreadsheets"),
"&ea="  + encodeURIComponent(spreadsheet || "Spreadsheet"),
"&el="  + encodeURIComponent(sheetname || "Sheet")
].join("");

return imageURL;

}

The given function will add a 1×1 tracking image to your spreadsheet cell. Save the script and close the window and return back to the spreadsheet.

4. Click on any empty cell and add the following formula.

=IMAGE(GOOGLEANALYTICS(“ analytics ID ” , ” Google Spreadsheet Name ” , ” Sub-Sheet Name ”))

The formula can be configured out to set the tracking code on spreadsheet cell and this will help out to track the spreadsheet in Google Analytics.

GenronTech Header-Cartoon

” The GOOGLEANALYTICS() function take  3 parameter Analytics ID Like UA-58745-85, your Google Spreadsheet name and Sub Spreadsheet Name. Replace with your current available parameter. The third parameter help out to track the sheet separately within the spreadsheet. “

Track Google Spreadsheet Visitors with Google Analytics Code

Now you can test Google spreadsheet Tracking with your Google analytics account and can have a look for total visits for the spreadsheet. The visit can be available with real time also, Some time there may be a delay with the result.

Leave a Reply

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