HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Collect subscription data

Describes how to collect and access data for subscription reports in Optimizely Customized Commerce

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

See Collect data for reports for information about data collection for reports.

Collect 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.

Set time range for the report

You determine the time range for the reports inappsettings.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.

            "SubscriptionTimeRangesInDays": [30, 60, 90, 180]

    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.

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

Access 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.

Related blog post: Implementing a custom reporting service for Customized Commerce