Note that there are some explanatory texts on larger screens.

plurals
  1. POTracking anonymous user activity
    primarykey
    data
    text
    <p>I need to track anonymous users with enabled cookies. </p> <p>Basically, they will go through the site, interact with it, and I would like to give them the best possible experience without requiring actual registration. Later on, if they want, they can register and their site activity will be tied to their new account. </p> <p>Something like Stackoverflow but with the difference that I expect that majority of my users won't actually register but occasionally just comeback.</p> <p>So, I don't want to create a bunch of dummy records in the Users table. And since I need it just for one table, I was thinking about something like this:</p> <p><strong>VoteHistory table</strong></p> <pre><code>Id TrackingToken VotingData 1 100 ... 2 100 ... 3 101 ... 4 102 ... </code></pre> <p><strong>Users table</strong></p> <pre><code>Id TrackingToken OtherUsersColumns 1 100 ... </code></pre> <p><strong>TrackingTokens table</strong></p> <pre><code>LastTrackingToken 102 </code></pre> <p>I would increment a LastTrackingToken integer field and simply add that value to the users cookie and track his voting activity with it. Then, if he decides to register, I would simply add his cookie TrackingToken value to his Users record.</p> <p>Initially I was thinking about a Guid/uniqueidentifier but since the voting table will be very large and I will need to query it, I'm worried about indexing the uniqueidentifier field. </p> <p>So, the questions are (sorry for 3 sub-questions, but they are so related and I think the context is important, so I don't want to duplicate the question and context description):</p> <ol> <li><p>Is integer field better when it comes to performance and indexing? Have in mind that TrackingToken is not a primary key field!</p></li> <li><p>Do you have some other idea how I could accomplish the scenario I outlined?</p></li> <li><p>If I decide to go with the manual generation of integer TrackingTokens, what would be the best way to reliably generate/increment a new TrackingToken? Assume a lot of concurrent users will hit the database.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload