Is there an API available to retrieve the unique visitors for a site within a specific month?

  • Are you looking for Rest API's to be called to fetch this data and will this api be called on CD or CM server?
    – ckhanna
    Commented Jul 10 at 14:48
  • Im looking for reporting api to fetch the unique visitors. This is run in CM @ckhanna
    – sns
    Commented Jul 11 at 3:21
  • Db reporting api
    – sns
    Commented Jul 11 at 3:28
  • I thnk I answered it here on one of your question raised earlier..sitecore.stackexchange.com/questions/37542/… you looking for something different?
    – ckhanna
    Commented Jul 11 at 5:40
  • @ckhanna do you have a better solution, In that solution both visitors and visits coming out as same number
    – sns
    Commented Jul 11 at 21:52

1 Answer 1


Solution 1:

The code below will return your contact facets and related interactions.

var contactCursor = await client.CreateContactEnumerator(
                        new ContactEnumeratorOptions(
                            new ContactExpandOptions(PersonalInformation.DefaultFacetKey)
                                Interactions = new RelatedInteractionsExpandOptions(IpInfo.DefaultFacetKey)
                                    StartDateTime = DateTime.UtcNow.AddDays(-300),
                                    EndDateTime = DateTime.UtcNow.AddDays(-200)
                            BatchSize = 200
var totalContactsCount = contactCursor.TotalCount;

Results are returned in batches of 200. You can use the MoveNext() method for the next batch size.

The above will result in the TotalContactsCount, which will also have the same multiple entries of the same contact ID.

Using lambda expression get the distinct count.

 var totalContactsCount = contactCursor.Current.Select(i => i.Id).Distinct().Count();

see the document for more details: Extracting contacts

Solution 2:

You can also use Analytics Database Manager (ADM) provided by Sitecore.

The Analytics Database Manager (ADM) is a module that allows performing various operations with the collection database, such as:

  • Removing contacts and interactions data.
  • Viewing database statistics.
  • Rebuild calculated facets.

See the documentation for more details: Analytics Database Manager (ADM)


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