« »
8/17/2017

Free custom pixel tracking with Google Spreadsheet

I think this is one of the simplest*, serverless™*, free forever, way to build a pixel tracker.

  • Create a new Google Spreadsheet
  • Tools > Script editor...
  • Copy/paste the code below
  • Publish > Deploy as web app...
  • Use the generated link inside an <img src="PASTE_URL_HERE"/>
  • Enjoy.
function doGet(e) {
  if(!e.parameter.id){throw new Error('Query parameter "id" is required')}
  var as=SpreadsheetApp.getActiveSpreadsheet();
  (as.getSheetByName('logs') || as.insertSheet('logs')).appendRow([new Date().toISOString().substring(0, 16).replace('T', ' '), e.parameter.id,  HtmlService.getUserAgent()]);
  return HtmlService.createHtmlOutput('http://blog.fgribreau.com/2017/08/free-pixel-tracker-with-google-spreadsheet.html');
}

* yes, you could also use the pixel tracker from Google Analytics.
* yes, it's a troll.

« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.