This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The most common way to track users in Google Analytics is by using cookies. But sometimes | |
there are platform and security limitations that will not allow cookies to be set or | |
stored for multiple sessions. The following code uses the localStorage property (available | |
now in most browsers) to provide an alternate way to the cookie-based solution. The code | |
is heavily commented to help even the most casual users understand the overall workings | |
of the code. Feel free to ignore this part if you know what you are doing. | |
This work is based on a Google example: | |
https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id |