Join our upcoming webinar on June 5, 2025 (Thursday). Register now!

Skip to product menu
Skip to main content

API tracking for Windows apps

Apptics SDK provides multiple options for tracking your application APIs. To track the APIs, configure them in the Apptics web console, refer to our User Guide.

  • Once the configuration is done in the web console, you will get an API ID.
  • Use the below at the start of the API.

For UWP apps

CopiedAppticsAnalytics.AppticsTracker.StartApiTracking(string url, string method);

For WinUI apps

CopiedWinUIAppticsAnalytics.RemoteLogger.PrintConsoleLogs(true);
  • The above method will return the "ApiDetails" object, which will be used in the EndApi call.
  • At end of API, call the below function.

For UWP apps

CopiedAppticsAnalytics.AppticsTracker.EndApiTracking(IAppticsApiInterface appticsApiInterface, ApiDetails apiDetails)

For WinUI apps

CopiedWinUIAppticsAnalytics.Tracker.EndApiTracking(IAppticsApiInterface appticsApiInterface, ApiDetails apiDetails)

(OR)

Use interceptor type tracking

  • Select APIs under the Stats from the left menu in the Apptics UI.
  • Add the APIs that you want to track, refer to the User Guide to understand how to add the APIs in the Apptics console.
  • The requested API is intercepted by the filter or a delegating handler.
  • The requested API is implemented for the HttpClient() from the following two namespaces, i.e. Windows.Web.Http and System.Net.Http.​

System.Net.Http

For UWP apps

CopiedHttpClientHandler systemHandler = new HttpClientHandler();          AppticsDelegatingHandler myHandler1 = new AppticsDelegatingHandler(AppticsApiInterface.Instance);
myHandler1.InnerHandler = systemHandler;
using (var client = new HttpClient(myHandler1))
{
}

For WinUI apps

CopiedHttpClientHandler systemHandler = new HttpClientHandler();          AppticsDelegatingHandler myHandler1 = new AppticsDelegatingHandler(AppticsApiInterface.Instance);
myHandler1.InnerHandler = systemHandler;
using (var client = new HttpClient(myHandler1))
{
}

(OR)

Windows.Web.Http

For UWP apps

Copiedvar baseProtocolFilter = new HttpBaseProtocolFilter();
var httpClientFilter = new AppticsIHttpFilter(baseProtocolFilter, AppticsApiInterface.Instance);
using (var client = new Windows.Web.Http.HttpClient(httpClientFilter))
{  
}

For WinUI apps

Copiedvar baseProtocolFilter = new HttpBaseProtocolFilter();
var httpClientFilter = new AppticsIHttpFilter(baseProtocolFilter, AppticsApiInterface.Instance);
using (var client = new Windows.Web.Http.HttpClient(httpClientFilter))
{ 
}