Azure Application Insights Custom Events allow you to track events in your Canvas app. A Custom Event can be anything that happen in you PowerApp such as 'order submitted', time registration deleted', 'settings saved' or anything else you find meaningful to track.

Tracking these type of events gives you deep insights into how users use your app.

I wrote a blog post, Using Azure Application Insights to monitor your PowerApps Canvas App, about using a PCF control to implement Application Insights PageViews telemetry in your PowerApps Canvas app to track screens used. Using Custom Events can improve the feedback you get from your app and usage of it and make you better equipped to deliver value for your users.

Read this blog post to see how you can implement this cool feature in your own app.

Sending Custom Events to Application Insights

In order to send Custom Events to Azure Application Insights I created an Azure Function with a HTTP Request trigger. The function takes two query parameters, code which holds the key to be allowed to execute the function and customEvents which is the name of the event that should be tracked.

The function parses the input and tracks it to Application Insights via the TelemetryClient.Track method.

#r "Newtonsoft.Json"
#r "Microsoft.ApplicationInsights"

using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using Microsoft.ApplicationInsights;

public static async Task Run(HttpRequest req, ILogger log)
   log.LogInformation("C# HTTP trigger function processed a request.");

   string customEvent = req.Query["customEvent"];
   string requestBody = await new StreamReader(req.Body).ReadToEndAsync();

   dynamic data = JsonConvert.DeserializeObject(requestBody);
   customEvent = customEvent ?? data?.customEvent;

   TelemetryClient telemetry = new TelemetryClient(){
      InstrumentationKey = "[Application Insights Instrumentation Key]"


   return customEvent != null ? (ActionResult)new OkResult() : new BadRequestObjectResult("Please pass a customEvent on the query string or in the request body");


Now the Azure Function is done, it's time to wrap it in a Custom Connector that can be used from PowerApps canvas apps. Wrapping the Azure Function in a Custom Connector allows the functionality to be shared among applications in the organizations so the functionality can be reused. It also ensures that it is simple for app makers to implement the feature. All they need to do is add the Custom Connector to their app and they are ready to track app usages.

Wrapping Azure Function in Custom Connector

Registering a Custom Connector is a four step wizard type experience.

General information

Give your Custom Connector a name and input the Host and Base URL.


For the purpose of the example in this blog post select API Key in Authentication Type.

The Parameter label is the text that refer to the secret the user must input when creating a connection to the Custom Connector.

Parameter name is code. This maps to the query parameter that will be passed on to the Azure Function and will authenticate the request.

Parameter location is Query. This will add the code parameter to the querystring in the request to the Azure Function.


Create a new Action and input its General Information

On the Request form click Import from sample. Select the GET verb and input the url to your function with the code parameter and click import.

Should look something like this:



Test your Custom Connector.

Tracking Custom Events from PowerApps Canvas Apps

Now go to you Canvas App and create a connection to your new Custom Connector.

Once the connection has been created you can send Custom Events to Azure Application Insights via the following formula:

ApplicationInsights.SendCustomEvent({customEvent: "CreateLeadSubmit"})

Add this to the button used to submit a Lead or other functionalities that you would like to track. This will track all of these events across your users and allow you to do advanced correlation PageViews if you have implemented the Application Insights Custom Control as written about here: