Log custom events for Partner Center
The Usage report in Partner Center lets you get info about custom events that you've defined in your Universal Windows Platform (UWP) app. A custom event is an arbitrary string that represents an event or activity in your app. For example, a game might define custom events named firstLevelPassed, secondLevelPassed, and so on, which are logged when the user passes each level in the game.
To log a custom event from your app, pass the custom event string to the Log method provided by the Microsoft Store Services SDK. You can review the total occurrences for your custom events in the Custom events section of the Usage report in Partner Center.
Note
Custom events that you log to Partner Center are unrelated to Windows events, and they do not appear in Event Viewer.
Prerequisites
Before you can review custom logging events in the Usage report for your app in Partner Center, your app must be published in the Store.
How to log custom events
If you have not done so already, Install the Microsoft Store Services SDK on your development computer.
Open your project in Visual Studio.
In Solution Explorer, right-click the References node for your project and click Add Reference.
In Reference Manager, expand Universal Windows and click Extensions.
In the list of SDKs, click the check box next to Microsoft Engagement Framework and click OK.
Add the following statement to the top of each code file where you want to log custom events.
using Microsoft.Services.Store.Engagement;
In each section of your code where you want to log a custom event, get a StoreServicesCustomEventLogger object and then call the Log method. Pass your custom event string to the method.
StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault(); logger.Log("myCustomEvent");
Note
The Usage report may take a long time to load if your app logs many custom events with long names. We recommend that you use brief names for your custom events.