Recent posts
![Fake delivery scams in SA](https://www.nichemarket.co.za/Admin/Content/images/metaDisplayImages/Blog/0/fake-delivery-scam-sa.png)
Alarming
Beware of Fake Delivery Scams Targeting South Africans!
24 July 2024
![Attribution tracking is failing us](https://www.nichemarket.co.za/Admin/Content/images/metaDisplayImages/Blog/0/channel-attribution-mistakes.png)
nichemarket Advice
Marketing Channel Attribution Is A Failing Marketing Strategy
23 July 2024
![Hotel bookings ensure comfortable travel](https://www.nichemarket.co.za/Admin/Content/images/metaDisplayImages/Blog/0/hotel-bookings-comfort.png)
Hit the Road
Hotel Bookings: The Key to Comfortable Traveling
22 July 2024
![How market making works in crypto markets](https://www.nichemarket.co.za/Admin/Content/images/metaDisplayImages/Blog/0/market-making-crypto.png)
Money Talks
Understanding Market-Making in Crypto
21 July 2024
Popular posts
Extravaganza
Trending Music Hashtags To Get Your Posts Noticed
24 August 2018
Geek Chic
How To Fix iPhone/iPad Only Charging In Certain Positions
05 July 2020
Extravaganza
Trending Wedding Hashtags To Get Your Posts Noticed
18 September 2018
Money Talks
How To Find Coupons & Vouchers Online In South Africa
28 March 2019
Tracking Google Sheets Views With Google Analytics
13 December 2017 | 0 comments | Posted by Che Kohler in nichemarket Advice
So you've gotten used to Google Analytics and have been happily tracking your visitors (or page views) on your website, but the buck usually stops there. Any property you do not personally own can't be tracked, and you may be losing out on valuable insights. If you're someone who uses GA sheets extensively especially for external use like creating templates then you would want to know how well they're doing, right?
The way I see it you have two options, one option is to just give up on gathering that data or try option two with a little bit of grit you can track views inside Google Spreadsheets. All you would need to do is insert a little snippet of tracking code inside your spreadsheet, and when someone opens the sheet, that visit will be recorded permanently in your Google Analytics account.
Tracking within properties, you do not own
Google Analytics provides a JavaScript snippet that can be inserted into web templates for tracking visits. The visit is recorded as an “event” and not a “page view”, and thus your spreadsheet opens will not artificially inflate your Google Analytics reports by adding the additional page views.
How to track Google sheet views
- To get started you will need to have your Google Analytics tracking ID on hand.
- Next open any Google Spreadsheet that you wish to track and go to Tools, Script Editor and copy-paste the following code. This is a custom Google Spreadsheet function that will embed the 1×1 tracking GIF image in our spreadsheets.
/**
* Track Spreadsheet views with Google Analytics
*
* @param {string} gaaccount Google Analytics Account like UA-1234-56.
* @param {string} spreadsheet Name of the Google Spreadsheet.
* @param {string} sheetname Name of individual Google Sheet.
* @return The 1x1 tracking GIF image
* @customfunction
*/
function GOOGLEANALYTICS(gaaccount, spreadsheet, sheetname) {
/**
* Written by Amit Agarwal
* Web: www.ctrlq.org
* Email: amit@labnol.org
*/
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;
}
- Save the code, close the Apps Script editor window and return to the spreadsheet.
- Click an empty cell and insert the following formula. The cell will be blank, but it contains an embedded image.
Note: You may want to change the background colour so it is easy to figure out which cell in the spreadsheet contains the tracking formula.
The
Test your tracking
Now open the spreadsheet in a new browser window and go to Google Analytics, Real Time, Overview to test if the tracking is working. If you would like to see all the visits and historical data, go to Behavior – Events – Overview and click on the Google Spreadsheets category.
For those trying to mask their usage
This tracking method will work even if the user has enabled ad blocking because of they way google Google Spreadsheets is set up. Like Gmail, Google sheets serves images through a proxy server. The downside is that you will never know the location of the visitor since all visits will show up as United States (the location of Google servers).
For more uses for this method check out our post - How To Track Email Open Rate With Google Analytics
Contact us
If you want to know more about tracking options for your site, don’t be shy we’re happy to assist. Simply contact us
You might also like
5 Best Platforms For Expert Trading Tips
12 July 2024
Posted by Joshua Byrne in Money Talks
If you are keen on sourcing valuable information about markets or would like to start trading, then these platforms should be part of your reading ma...
Read moreHotel Bookings: The Key to Comfortable Traveling
22 July 2024
Posted by Lisa Frank in Hit the Road
A good hotel reservation and some proper travel planning can determine whether the trip will be successful or filled with unpleasant or costly surpri...
Read more![](/Content/images/avatar.png)
{{comment.sUserName}}
{{comment.iDayLastEdit}} day ago
{{comment.iDayLastEdit}} days ago