# Open statistics

The open statistics provide statistics about the opening of the emails that are sent through a campaign. They can be used to provide information like:

* Date of the last email that has been opened;
* Total number of times messages have been opened;
* The number of recipients that opened the email;

This topic explains how to obtain these statistics and how to work with them in order to visualize specific information.

## Generating open statistics

The generation of the open statistics objects is handled by Sitefinity CMS. Whenever a subscriber opens an email from a campaign, an OpenStat object is created and stored in the data base.

The OpenStat object contains information regarding the following:

* The id of the campaign to which the opened e-mail belongs;
* The date on which the e-mail was opened;
* The id of the subscriber, who opened the e-mail;

## Querying open statistics

To query all of the open statistics for a specific campaign, you must use the NewslettersManager class. The following code gets the open statistics for the campaign with the specified *ID* through the Native API.

```C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Sitefinity.Modules.Newsletters;
using Telerik.Sitefinity.Newsletters.Model;

namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.SitefinityEssentials.Modules.EmailCampaigns.Statistics
{
    public partial class EmailCampaignsSnippets
    {
        public List<OpenStat> GetOpenStats(Guid campaignId)
        {
            NewslettersManager manager = NewslettersManager.GetManager();

            var openStats = manager.GetOpenStats().Where(o => o.CampaignId == campaignId).ToList();

            return openStats;
        }
    }
}
```

First, you initialize the NewslettersManager. Then, you call GetOpenStats method to retrieve all open statistics and, finally, you filter the statistics based on the *CampaignId* property.

In order to obtain more specific information, you can additionally manipulate the result collection by using the *OpenDate* and *SubscriberId*properties of the *OpenStat* object.
