What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

This is related to the 'number of times your profile is visited by others'.

How exactly does it work? For example, in my profile page, profile view count is 171.

share|improve this question
    
I'm not sure, but it might use the same method as the question views counter. If not, it's likely just a list of unique IP addresses which have visited your profile. –  animuson May 16 '12 at 6:08
    
I assume profile views are the same like question views so this answer by Jeff probably answers your issue as well. Official response confirming this will be better though. –  Shadow Wizard May 16 '12 at 6:49
    
See a link once.meta.stackexchange.com/questions/87092/… –  Shree May 16 '12 at 11:20
1  
@ShadowWizard I started a bounty on this, hopefully we can get an answer, even if they don't tell us exactly how it works. –  Vote to Close Mar 2 at 3:11
2  
Cheers @LowerClassOverflowian but from own experience and lots of bounties, even this doesn't always help to lure them inside. –  Shadow Wizard Mar 2 at 9:32
add comment

2 Answers

As far as I know, the profile counter increases when any new user visits your profile. The Stack Engine might be storing some data related to the user who visited your profile once and checks it next time if the user visits. If it's a new user your profile counter increases else remains the same. This is just a thought from my side that how it would be working, exactly Moderators might give a better idea.

share|improve this answer
13  
Actually only developers (all the 12 marked as "Software Developer" there) can answer this as only they know the code behind this whole site. :) –  Shadow Wizard May 16 '12 at 6:52
    
@ShaDowWizArd I am curious as well but I haven't found any official answer from any SO developer.. is there any way to contact them directly? –  mm24 Jun 21 '12 at 9:33
    
@mm24 yes indeed, some of them publish contact details (email, blog, twitter) in their public profile e.g. Mark Gravell so it means you can at least try. They don't have to answer though, you must remember they got lots of work and this specific issue is probably not on top of their priorities. –  Shadow Wizard Jun 21 '12 at 10:54
    
@ShaDowWizArd sure, I imagine they must be sitting all they coding and trying to deliver their deadlines, also StackOverflow is hiring new programmers which is an indicator on how busy they must be. –  mm24 Jun 21 '12 at 10:56
    
@ShaWizDowArd what does mean by profile-view? -- When would you like to view someone's profile when he post good or bad ?? –  Grijesh Chauhan Jul 8 '13 at 20:15
    
@GrijeshChauhan it means browsing to the user profile. Not just when there' good or bad post, even just to check other posts that user made, or to see other suggested edits when reviewing one etc. –  Shadow Wizard Jul 8 '13 at 20:18
add comment

To note, I am not a Stack Exchange developer nor am I associated with them. As such, this is an unofficial response. I was just very curious and am a huge fan of the ASP.NET MVC framework. These are my findings.

I believe it is caching... it is always caching.

What is it caching? It is caching something Stack Exchange has termed QuerySets which are pretty much stored sql execution plans which match to a query, a userid, and an ip address (there are a few other params). This information is dated, I am pretty sure the code is a cached version. But really, it is from 2012ish.

public class QuerySet
{

    public int Id { get; set; }
    public int InitialRevisionId { get; set; }
    public int CurrentRevisionId { get; set; }
    public int? OwnerId { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
    public DateTime LastActivity { get; set; }
    public int Votes { get; set; }
    public int Views { get; set; }
    public string OwnerIp { get; set; }

    // these are loaded via QueryUtil.LoadFullQuerySet

    public Revision InitialRevision { get; set; }
    public Revision CurrentRevision { get; set; }

    public List<Revision> Revisions { get; set; }

    public User Owner { get; set; }

}

The execution plans are cached in CachedResult.ExecutionPlan by linking CachedResult.QueryHash to QuerySet.Revision.Query.QueryHash.

The QuerySet is created the first time a sql execution plan is created from one IP address requesting a page, otherwise the QuerySet is cached, in which case the revision is updated. The cache window is 15 minutes, and inside of this window, no new views are counted. Every time the QuerySet is fetched it will reset the window.

private const int VIEW_EXPIRES_SECS = 15*60; // view information expires in 15 minutes

If the window has expired, then it will increase the count - note SET Views = Views + 1.

public static void TrackQueryView(string ipAddress, int querySetId)
{
    if (IsNewView(ipAddress, querySetId))
    {
        Current.DB.Execute(@"
            UPDATE
                QuerySets
            SET
                Views = Views + 1
            WHERE
                Id = @querySetId",
            new
            {
                querySetId
            }
        );
    }
}

The call to isNewView is checking to see if the current QuerySet which is saved is relevant for the page based on the current time window.

public static bool IsNewView(string ipAddress, int revisionId)
{
    string key = "qv - " + ipAddress + " " + revisionId;
    bool isNewView = true;

    int currentBracket = GetTimeBracket();

    object cached = HttpRuntime.Cache.Get(key);
    if (cached != null)
    {
        var cachedBracket = (int) cached;
        if (cachedBracket == currentBracket || cachedBracket == (currentBracket - 1))
        {
                isNewView = false;
        }
    }

    HttpRuntime.Cache.Insert(
        key,
        currentBracket,
        null,
        Cache.NoAbsoluteExpiration,
        new TimeSpan(0, 0, VIEW_EXPIRES_SECS),
        CacheItemPriority.High,
        null
        );

    return isNewView;
}

This is how it used to be, I am fairly certain that it has changed. When content changed, the revisionId would change, thereby changing the key and allowing a new view to count. However, this no longer happens so I am going to assume they patched that functionality. It is also possible that the network moved to a higher performance caching mechanism such as a self contained server farm solely for caching. One possibility would be that the window has drastically increased from 15 seconds to a significant amount of time.

Now, back to the exact scenario explained in the bounty for this question by LowerClassOverflowian. How can he have 1000 views in 3 months? Personally I think 5k rep in 3 months is pretty impressive, and the views relate to people who have benefited from the content produced by this user.

This was the best I could do from the outside looking in.

share|improve this answer
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .