0

I have created a local instance of the Sitecore on my machine.I need to track the count of visitors accessing my site. Since this is a local site, I will be opening in a different session from the same machine. I just need the count of how many times the page is visited.

Does Sitecore do this by default or do I need to write custom code to achieve this result?

5

Sitecore store all the data in collection db first (mongo db or starting from 9.0 you can also use SQL database for this), then transfers the data to reporting database (it will take around 20 min). So you can try below senario if data is not appearing in reporting database:

All the anonymous visitors should be tracked in collection database, a couple of things you can try

  1. clearing your cookies and try again so that sitecore does not think you are the same visitor

  2. In dev environment reduce your session timeout to a lesser value (Say 2 minutes, default is 20 mins)

  3. Check if your SC_Analytics_global_cookie is getting refreshed with a different GUID (That guid is your contact ID)

  4. Disable your Sitecore.Analytics.RobotDetection.config file and then try again

  5. Add @Html.Sitecore().VisitorIdentification in your layout

1
  • Thank you for the information.Disabled the RobotDetection.config file by following this article link
    – rams
    Feb 3 '18 at 6:26
3

One other tip for your scenario. As you're generating test visits, not only do you need to clear cookies to appear as a different user, but at the end of each browsing session, you'll want to hit an endpoint (e.g. aspx page or MVC action) which flushes your session:

Sitecore.Analytics.Tracker.Current.CurrentPage.Cancel();
Sitecore.Analytics.Tracker.Current.EndTracking();
HttpContext.Current.Session.Abandon();

This will flush data immediately so you don't have to wait for the session to expire.

You will likely also want to disable robot detection in a config patch:

<settings>
    <setting name="Analytics.AutoDetectBots">
        <x:attribute name="value">false</x:attribute>
    </setting>
    <setting name="Analytics.Robots.IgnoreRobots">
        <x:attribute name="value">false</x:attribute>
    </setting>
</settings>
2

Also make sure you have this setting on to allow the tracking of anonymous visitors. By default it is false and will not track anonymous:

<setting name="ContentSearch.Analytics.IndexAnonymousContacts" value="true"/>

Here you can read more about Tracking anonymous users in Xdb post 8.2 update-3

2
1

Sitecore will track visits, but you will need to make sure the cookies are cleared or you use different browsers. Otherwise, it will think you are the same user doing multiple visits.

You will need to make sure you have your analytics set up and working. You may trigger a bunch of visits, but if you do not see any data then you will need to investigate your logs for errors and look for SSE questions on those errors so that you can identify what is wrong with your analytics setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.