マーケティングオートメーション・レポーティングAPI

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

マーケティング自動化レポートAPIは、発信者が計画や活動の統計や指標を取得することを可能にします。

自動化レポートクライアントへのアクセス

以下の例は、Sitecore文脈でIAutomationReportingClientにアクセスする方法を示しています。

using Sitecore.DependencyInjection; using Sitecore.Xdb.MarketingAutomation.ReportingClient; using Microsoft.Extensions.DependencyInjection;

namespace Documentation { public class AutomationAPI { public void Example() { var reportingCLient = ServiceLocator.ServiceProvider.GetService(); } } }

運用

!注各メソッドには同期型と非同期型があります。

プラン統計を入手

GetPlanStatisticsAsync()メソッドはプランIDのリストを受け取り、PlanStatisticsオブジェクトのリストを返します。以下の例は利用可能な統計データの詳細です。

using Sitecore.DependencyInjection; using Sitecore.Xdb.MarketingAutomation.ReportingClient; using Microsoft.Extensions.DependencyInjection; using System; using Sitecore.Xdb.MarketingAutomation.Core.Reporting; using Sitecore.Xdb.MarketingAutomation.Core.Collections;

namespace Documentation { public class GetPlanStats { public async void Example() { var reportingClient = ServiceLocator.ServiceProvider.GetService();

var result = await reportingClient.GetPlanStatisticsAsync(new { Guid.Parse("{19F1B472-11E4-4927-84EC-71E10136CE4E}"), // Plan ID #1 Guid.Parse("{6CCC76C7-85DE-4214-B51B-D045065129A7}") // Plan ID #2 });

foreach (PlanStatistics stat in result) { Guid planID = stat.PlanDefinitionId; // The plan ID long allEnrollmentsCount = stat.AllEnrollmentCount; // All enrollments in the history of this plan long currentEnrollmentsCount = stat.CurrentEnrollmentCount; // Current enrollments } } } }

!注システムが与えられたID計画を指定された方法で見つけられなければ、そのIDについては何も返されません。例えば、リクエストに5つのIDが含まれていて2つのIDが見つからない場合、システムは3つのPlanStatisticsインスタンスのみを返します。

計画報告書を受け取る

GetPlanReportAsync()メソッドは単一のプランID、開始日、終了日を取り、PlanReportを返します。開始日と終了日はActivityCurrentContactCountとPlanCurrentContactCountの値に影響を与えます。以下の例は利用可能な統計量の詳細です:

using Sitecore.DependencyInjection; using Sitecore.Xdb.MarketingAutomation.ReportingClient; using Microsoft.Extensions.DependencyInjection; using System; using Sitecore.Xdb.MarketingAutomation.Core.Reporting; using Sitecore.Xdb.MarketingAutomation.Core.Collections;

namespace Documentation { public class GetPlanReport { public async void Example() { var reportingClient = ServiceLocator.ServiceProvider.GetService();

var planId = Guid.Parse("{C5F5C4AA-3D00-41ED-AEA2-740129E340E3}"); var reportStart = DateTime.UtcNow.AddDays(-1); var reportEnd = DateTime.UtcNow; var result = await reportingClient.GetPlanReportAsync(planId, reportStart, reportEnd);

var allContactsByActivity = result.ActivityAllContactCount; // The number of contacts that have ever been enrolled by each activity. The dictionary key is the ID of the activity and the value if the enrollment count. var allCurrentContactsByActivity = result.ActivityCurrentContactCount; // The number of contacts enrolled by each activity within the start and end dates. The dictionary key is the ID of the activity and the value if the enrollment count. var allContacts = result.PlanAllContactCount; // The number of contacts that have ever been enrolled in any activity of the plan. This is basically a sum of all of the counts from the ActivityAllContactCount dictionary. var currentContactCount = result.PlanCurrentContactCount; // The number of contacts enrolled in any activity of the plan within the start and end dates. This is basically a sum of all of the counts from the ActivityCurrentContactCount dictionary. } } }

この記事を改善するための提案がある場合は、 お知らせください!