Loading...
Area: Optimizely Commerce
Applies to versions: 14 and higher
Other versions:

Collecting subscription data

Recommended reading 

This topic describes how to collect and access data for subscription reports in Optimizely Commerce.

How it works

The collect data feature provides raw data for created subsctions and includes the ability to specify time periods, and scheduled jobs to collect different types of Commerce data. The collected data is made available under the Reports tab in the Commerce user interface.

See Collecting data for reports for more information about data collection for reports.

Collecting subscription data

A subscription allows for recurring orders, and for payments to be spread over time, providing flexibility in how you sell your products. The Export subscription data feature lets you collect and export subscription-based data to be consumed by other applications. 

Setting time range for the report

You determine the time range for the reports in appsettings.json or inside the ConfigureServices method of Startup.cs. The default value is 90 days. You can set a single value or multiple values as example below.

//appsettings.json
{
"Commerce":{
    "ReportingTimeRangeOptions":{
        "SubscriptionTimeRangesInDays": [30, 60, 90, 180]
        }
    }
}
//Startup.cs
public void ConfigureServices(IServiceCollection services)
{
    services.Configure<ReportingTimeRangeOptions>(o =>
    {
        o.SubscriptionTimeRangesInDays= new HashSet<int>() { 30, 60, 90, 180 };
    });
}

Values are numbers of days prior to the date that you run the Collect Reporting Subscription scheduled job. Begin and end dates are included in the subscription dates. For each value, the job creates one corresponding CSV file.

The above example means that the Collect Reporting Subscription scheduled job generates four CSV files: one for all subscriptions created within the last 30 days, another for subscriptions created within the last 60 days, and so on. Each CSV file is compressed into a .zip file.

The Reporting Subscription scheduled job

The scheduled job Collect Reporting Subscription collects subscription data in the background. Like other scheduled jobs, you can run this manually or at predetermined time intervals.

Subscription data

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

  • LineItemID
  • LineItemCode
  • DisplayName
  • PlacedPrice
  • Quantity
  • ExtendedPrice
  • EntryDiscountAmount: The line item's discount amount
  • SalesTax
  • Currency
  • SubscriptionId
  • Subscription Status
  • CustomerID
  • CustomerName
  • MarketId
  • Cycle Mode
  • Cycle Length
  • Max Cycles Count
  • Completed Cycles Count
  • Is Active
  • Start Date
  • End Date
  • Last Transaction Date
  • Total Revenue - revenue of all orders completed by subscription

    Accessing the data

    After collecting the report data, a link to the exported .zip files appears under Reports. Click the link to download the data. Collected report data is presented in a comma-separated value (CSV) format.

    CommerceSubscriptionReportingView.png

    Related topics

    Do you find this information helpful? Please log in to provide feedback.

    Last updated: Sep 28, 2021

    Recommended reading