HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


Collected Commerce data can be accessed under **Reports** in the Optimizely Customized Commerce user interface. The data is made available for export to be consumed by other applications. Data can be collected for purchase orders and subscriptions. The data is also used by the Sales by Day report in Commerce Manager.



The collect data feature provides raw data for created orders and includes:

  • Ability to specify time periods for which you want the data (for example, all orders created in the past 90 days) in the web.config.

  • Ability to collect data when an order is placed or an existing order is modified.

  • Scheduled jobs  that collect the raw data and exports it to a compressed zip file, which contains a csv file with the data.

  • The **Reports** menu, which displays links for downloading exported zip files.

  • Permissions that control access to the **Reports** menu.

## Set time range for the report

You determine the time range for the reports in the web.config file, under <appSettings>.



Values are numbers of days prior to the date that you run the **Collect Report Data** [Scheduled job](🔗). Start and end dates are included in the order dates. For each value, the job creates one corresponding CSV file.

The above example means that the Collect Report Data scheduled job generates 4 CSV files: one for all orders created within the last _30_ days, another for orders created within the last _60_ days, and so on.

Each CSV file is compressed into a .zip file.

In the example below, the report compiles one report containing order data for the past year (365 days).



Note

If the web.config has no settings for episerver:commerce.ReportingTimeRanges, the default value is 90.

## Collect report data

### Use a scheduled job

You can use scheduled jobs in the **Admin view** to collect data for the reports. For example, to collect order data, run the scheduled job **Collect Order Data for Reports** collects order data in the background.

Like other scheduled jobs, you can run this manually or at predetermined time intervals.



The scheduled job **Collect Subscription Data for Reports** collects data for subscriptions, see [Collecting subscription data](🔗).

### Use order events

_Order data_ can also be collected whenever an order is placed or an existing order is modified by adding, updating, or removing line items. Use the following web.config setting, which occurs under <appSettings>, to determine whether to collect order data when these order events occur.



Note

If no value is set for episerver:commerce.EnableEventDrivenOrderReporting, order data is collected. In other words, the default value is **True**.

## Permissions for reports

Only users with following roles can access the **Reports** menu in the Customized Commerce user interface.

  • **CommerceAdmins**

  • **ReportManagers**

## Access collected data

After collecting the report data, a link to the exported .zip files appears under **Reports**. Click the link to download the data.



## Data format

Collected report data is presented in a comma-separated value (CSV) format. [Open full-size image in new window](🔗)



## Order data reports

This version provides the following information for each order created during the specified time range in LineItem level.

  • LineItemID

  • LineItemCode

  • DisplayName

  • PlacedPrice

  • Quantity

  • ExtendedPrice

  • EntryDiscountAmount: The line item's discount amount

  • SalesTax

  • Currency

  • OrderGroupId

  • OrderNumber

  • CustomerID

  • CustomerName

  • MarketId

  • OrderCreated: The order creation date

  • AdditionalValues - see **Add properties to order data**.

### Add properties to order data

If default values do not meet your requirements, you can add properties by overriding the GetAdditionalData() method of ReportingAdditionalDataHandler.



The extension point in DefaultReportingService.ExportOrderDataAsCsv() calls to GetAdditionalData() to assign value for AdditionalValues, then exports AdditionalValues like other default values to the csv file.

**Related blog post:** [Implementing a custom reporting service for Commerce](🔗)