To Track Or Not To Track?
Tracking visitors in your Web site is great for statistics but I would say, do it always Anonymously, in other words, do not collect neither track personal behavior, it's not polite nor completely legal. Particularly if you do it using GA (Google Analytics, see TOS #7 Privacy).
Now, let's deal with the technicalities around monitoring user's visitors within your domain site using Google Apps Script, step by step simplified:
I believe, that's it
Share your comments and question with g+1 below, I will thank you for that ;)