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'); }
I think I found one of the simplest, serverless™, free forever, pixel tracker. https://t.co/faxGCZ3jfi pic.twitter.com/M7PPndZ3tZ
— François-G. Ribreau (@FGRibreau) August 17, 2017
* yes, you could also use the pixel tracker from Google Analytics.
* yes, it's a troll.